Spring web.xml:
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${jms.jndi.connectionfactory}"></property> </bean> <!-- Queue --> <bean id="outgingDestination" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${jms.outgoing.destination}"></property> </bean> <bean id="incomingDestination" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${jms.incoming.destination}"></property> </bean>
jms.properties:
jms.receive.timeout=5000
jms.jndi.connectionfactory=java:comp/env/jms/NormalConnectionFactory
jms.incoming.destination=java:comp/env/jms/queue/channel0
jms.outgoing.destination=java:comp/env/jms/queue/channel1
tomcat conf/context.xml (Eclipse Servers) :
<Resource name="jms/NormalConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://10.135.63.33:61616" brokerName="localhost" userName="system" password="manager" useAsyncSend="true" useEmbeddedBroker="false" /> <Resource name="jms/queue/channel0" auth="Container" type="org.apache.activemq.command.ActiveMQQueue" factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="test.queue" /> <Resource name="jms/queue/channel1" auth="Container" type="org.apache.activemq.command.ActiveMQQueue" factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="test.replyqueue" />