Eclipse dynamic web app - context.xml for JNDI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Eclipse dynamic web app - context.xml for JNDI

ivanachukapawn
I'm attempting to build a simple dynamic web app (using Eclipse Mars) which uses ActiveMQ to queue a message to a message-broker network.  I found a web site which recommended that:

<b>As Tomcat has only a static JNDI, we add the ConnectionFactory and the Queue via the context.xml:

My questions are:  

In my Eclipse project structure, where should I place this file (the project will be exported to a WAR file and placed in the /opt/tomcat/webapps directory on a CentOS 7 VM) ?
                  and
Should the file be named context.xml  ?

The suggested content for this file is:

<?xml version='1.0' encoding='utf-8'?>
<Context>
    <Resource
            name="jms/ConnectionFactory"
            auth="Container"
            type="org.apache.activemq.ActiveMQConnectionFactory"
            description="JMS Connection Factory"
            factory="org.apache.activemq.jndi.JNDIReferenceFactory"
            brokerURL="vm://localhost"
            brokerName="LocalActiveMQBroker"
            useEmbeddedBroker="true"/>
 
    <Resource name="jms/queue/MyQueue"
              auth="Container"
              type="org.apache.activemq.command.ActiveMQQueue"
              factory="org.apache.activemq.jndi.JNDIReferenceFactory"
              physicalName="MY.TEST.FOO.QUEUE"/>
</Context>