activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JoC <johannescar...@gmail.com>
Subject Working with Tomcat/WTP but not standalone Tomcat
Date Thu, 13 Dec 2007 10:37:07 GMT

I have some problems setting up ActiveMQ with a standalone Tomcat.

I have created a minimal web app with a Spring MDP that works great if I use
Eclipse with WTP. Clean tomcat, 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)

Below is my configuration:

All libs are in web-inf/lib:
activemq-all-5.0-SNAPSHOT.jar
commons-logging-1.1.jar
spring-2.5.jar

<root>/meta-inf/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" />
        
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>
    
Spring appcontext.xml:
    <bean id="jndiTemplate"
        class="org.springframework.jndi.JndiTemplate">
    </bean>
    <bean id="jmsQueueConnectionFactory"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>jms/test/cfTEST001</value>
        </property>
        <property name="resourceRef">
            <value>true</value>
        </property>
    </bean>
    <bean id="jmsQueueTemplate"
        class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <ref bean="jmsQueueConnectionFactory" />
        </property>
    </bean>
    <bean id="destination"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>jms/test/TEST001FirstQueue</value>
        </property>
        <property name="resourceRef">
            <value>true</value>
        </property>
    </bean>
    <bean id="consumer"
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory"
            ref="jmsQueueConnectionFactory" />
        <property name="messageListener" ref="consumerPojo" />
        <property name="concurrentConsumers" value="5" />
        <property name="destination" ref="destination" />
    </bean>
    
    <!-- a sample POJO consumer -->
    <bean id="consumerPojo" class="se.johannesc.MyListener">
        <property name="jmsTemplate" ref="jmsQueueTemplate" />
    </bean>

-- 
View this message in context: http://www.nabble.com/Working-with-Tomcat-WTP-but-not-standalone-Tomcat-tp14313619s2354p14313619.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message