1

I recently changed some of my application to use the the following:

org.springframework.jndi.JndiTemplate  
org.springframework.jms.connection.CachingConnectionFactory   
org.springframework.jms.core.JmsTemplate  

Everything is working fine and I'm able to deploy my war files and send JMS messages to the queue.

However something peculiar happens when my managed server restarts. The deployables will all go into a fail state which requires me to then manually start them up.

This started happening after the change to use caching connection factory, jndi template and jms template.

My SpringConfig file:

<!-- Service Controller begin -->
<bean id="appUtils" class="com.foo.util.AppUtil" lazy-init="true" />
<bean id="jms_jndiTemplate" class="org.springframework.jndi.JndiTemplate" lazy-init="true">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">#{jmsJndiFactory}</prop>
            <prop key="java.naming.provider.url">#{jmsIp}</prop>
        </props>
    </property>
</bean>
<bean id="jmsUtils" class="com.foo.JmsUtil" >
     <property name="template">
       <bean class="org.springframework.jms.core.JmsTemplate" lazy-init="true">
            <property name="connectionFactory">
                  <bean class="org.springframework.jms.connection.CachingConnectionFactory" lazy-init="true">
                        <property name="sessionCacheSize" value="10" />
                        <property name="targetConnectionFactory">
                            <bean class="org.springframework.jndi.JndiObjectFactoryBean">
                                <property name="jndiTemplate" ref="jms_jndiTemplate" />
                                <property name="jndiName" ref="jmsFactory" />
                            </bean>
                        </property>
                    </bean>
            </property>
        </bean>
     </property>
     <property name="destination">
        <bean class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
            <property name="jndiTemplate" ref="jms_jndiTemplate" />
            <property name="jndiName" ref="jmsQueue" />
        </bean>
     </property>
 </bean>    

ApplicationContext file:

<bean id="jmsQueue" class="java.lang.String" ><constructor-arg value="${jmsQueue.local}" /></bean>
<bean id="jmsFactory" class="java.lang.String" ><constructor-arg value="${jmsFactory.local}" /></bean>
<bean id="jmsJndiFactory" class="java.lang.String" ><constructor-arg value="${jmsJndiFactory.local}" /></bean>
<bean id="jmsIp" class="java.lang.String" ><constructor-arg value="${jmsIp.local}" /></bean>    

applicationProperties file:

jmsQueue.local=jms/Queue
jmsFactory.local=jms/ConnectionFactory
jmsJndiFactory.local=weblogic.jndi.WLInitialContextFactory
jmsIp.local=t3://localhost:7031

Anyone has any idea as to why this might be happening? I'm using Weblogic. Any help would be greatly appreciated.

Thanks!

Edit: Forgot to mention that the error causing the failed state is

javax.naming.NameNotFoundException: Unable to resolve 'jms.Queue'. Resolved 'jms'; remaining name 'Queue'.
Mark
  • 25
  • 1
  • 7
  • I have seen something similar when a server is not fully up and something tries to access JMS/JNDI. Do you see any other errors in the logs? If it's a timing issue you may want to set the `Deployment Order` for your applications to ensure they come up later in the start process – Display Name is missing Dec 01 '14 at 18:28
  • Hi thanks for the reply Where can I find out more of the deployment order and where do I set it? – Mark Dec 02 '14 at 01:52
  • @DisplayNameismissing The other error would be `java.lang.Exception at weblogic.jndi.internal.VersionHandler.checkGlobalResource(VersionHandler.java:457) at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:187) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:220) at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:412) ` – Mark Dec 02 '14 at 02:03
  • If you open the admin console and go to `Deployments -> -> Overview` there is a field for deployment order. The default is 100 but a higher number will result in the deploy happening later in the startup process. Unfortunately I don't think I have seen the error in your last comment before – Display Name is missing Dec 02 '14 at 16:23
  • @DisplayNameismissing Thanks for the suggestion, unfortunately setting the deployment order doesn't seem to solve this problem. I just find it weird that after changing to CachingConnectionFactory/JMSTemplate/JndiTemplate that this happens. – Mark Dec 03 '14 at 01:48

1 Answers1

0

This is a JNDI error. The message means "I tried to find jms/Queue in the JNDI context but I only got as far as jms; there is no Queue child below".

Check the resources which you configured for the application in WebSphere.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820