I am trying to configure ActiveMQ from a Global JNDI Resource in Tomcat. I have the following:
<Resource name="jms/ActiveMQConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="failover:(tcp://localhost:12000,tcp://localhost:120001)" brokerName="ActiveMQBroker"/> Then in Spring I have the following: <bean id="jmsFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:/comp/env/jms/ActiveMQConnectionFactory"/> </bean> <bean id="JMSTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory"> <bean class="org.springframework.jms.connection.SingleConnectionFactory"> <property name="targetConnectionFactory" ref="jmsFactory" /> </bean> </property> </bean> When I deploy this code I get the following error: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.activemq.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFacto ry] for property 'targetConnectionFactory'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found If I understand this correctly, it means that the jmsFactory bean was populated from JNDI as expected. However, when trying to configure the jmsTemplate it expects a ConnectionFactory object instead of an ActiveMQConnectionFactory. The weird thing is that if I deploy the code using the following everything works fine. Here Spring takes care of creating the jmsFactoryM directly. <bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="broker"> <property name="brokerURL" value="tcp://localhost:62002"/> </bean> <bean id="JMSTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory"> <!-- lets wrap in a pool to avoid creating a connection per send --> <bean class="org.springframework.jms.connection.SingleConnectionFactory"> <property name="targetConnectionFactory" ref="jmsFactory" /> </bean> </property> </bean> Unfortunately, I don't understand the difference between the two spring setups. The both should end up with and ActiveMQConnectionFactory that is being passed to the jmsTemplate. Why should it work one way but not the other? Thanks, Pete -- View this message in context: http://www.nabble.com/Spring-%2B-Tomcat-Global-JNDI-Resource-tf2689821.html#a7500813 Sent from the ActiveMQ - User mailing list archive at Nabble.com.