...
2. Configure Tomcat with ActiveMQ.
Configure the context.xml configuration file of your Tomcat server. This file is located at <HOME_TOMCAT>/conf/. Use this configuration if you are using Tomcat 5.5 or later.
Code Block |
---|
---context.xml---- <Resource auth="Container" name="jms/ConnectionFactory" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://localhost:61616" useEmbeddedBroker="false" brokerName="localhost"/> <Resource auth="Container" name="chatChannel" type="org.apache.activemq.command.ActiveMQTopic" description="JMS Topic" factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="chatChannel"/> |
...
Code Block |
---|
---server.properties---- jndi.messaging.java.naming.provider.url: vm://localhost |
Code Block |
---|
---context.xml---- <Resource auth="Container" name="jms/ConnectionFactory" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="vm://localhost" useEmbeddedBroker="true" brokerName="localhost"/> |
...
This configuration was tested with Apache ActiveMQ v 5.5.1 and Tomcat v. 7.0.16.