Hi, I have a problem getting ActiveMQ to work with Tomcat6 correctly. 

I have created a minimal web app with a Spring MDP that works great if
I use Eclipse with WTP. Clean tomcat6, clean eclipse. New web project.

However, if I export the app as a war and deploy to an external (also
CLEAN) Tomcat I get this error:

Caused by: javax.naming.NamingException: Cannot create resource
instance
        at
org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:114)
        ...

I can't seem to figure out why it should differ with WTP contra
standalone tomcat. Anyone that can help me out here? (I have a zip file
if anyone is interested) 

I have tried to place my resources in various places: server.xml, in
the context tag in server.xml, in a context.xml in root/meta-inf but
with the same result.

I have also tried to access the resource in a plain servlet without
Spring with the same result. Here are my configuration below:

I have this in my context.xml:
        <Resource name="jms/test/cfTEST001" auth="Container"
                type="org.apache.activemq.ActiveMQConnectionFactory"
                description="JMS Connection Factory"
                factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                brokerURL="tcp://localhost:61616" 
brokerName="LocalActiveMQBroker"
                useEmbeddedBroker="false" />

        <Resource name="jms/test/TEST001FirstQueue" auth="Container"
                type="org.apache.activemq.command.ActiveMQQueue"
                description="Receiving messages on this queue"
                factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                physicalName="Q1" />

and then in my web.xml:
  <resource-env-ref>
    <resource-env-ref-name>
                        jms/test/cfTEST001
                </resource-env-ref-name>
    <resource-env-ref-type>
                        javax.jms.QueueConnectionFactory
                </resource-env-ref-type>
  </resource-env-ref>
  <resource-env-ref>
    <resource-env-ref-name>
                        jms/test/TEST001FirstQueue
                </resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
  </resource-env-ref>

and to try things out I created a servlet with this code:
InitialContext initCtx = new InitialContext();
Context envContext = (Context) initCtx.lookup("java:comp/env");
ConnectionFactory connectionFactory = (ConnectionFactory)
envContext.lookup("jms/test/cfTEST001");
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);

MessageProducer producer = session.createProducer((Destination)
envContext.lookup("jms/test/TEST001FirstQueue"));
TextMessage testMessage = session.createTextMessage();
testMessage.setText("My Message);
producer.send(testMessage);

This works just fine running in Eclipse/WTP but not in plain Tomcat.
Anyone here that can tell me why?

BR
/Johannes



        
        
                
_________________________________________________________
Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda
kalender. Dessutom 250 MB gratis, virusscanning och antispam. Få den på: 
http://se.mail.yahoo.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to