Spring: JMSTemplate/CachingConnectionFactory deployables unable to start automatically in weblogic

1.1k views Asked by At

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'.
1

There are 1 answers

0
Aaron Digulla On

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.