activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aakhunaten <akhna...@gmail.com>
Subject Tomcat6 + Spring 2.5 + ActiveMQ
Date Thu, 16 Oct 2008 09:20:59 GMT

Hi,

I am very new to ActiveMQ or messaging as such, so I apologize if my
question is very dumb.

I have this app developed with Appfuse 2.0.2 with Spring 2.5. I run activemq
separately from /usr/share/activemq/bin/activemq.

I have used embedded brokers inside spring's config file
(applicationContext-resources.xml) like so

<<
<!-- ActiveMQ conf -->
    <!--  Embedded ActiveMQ Broker -->
    <amq:broker useJmx="false" persistent="false">
        <amq:transportConnectors>
            <amq:transportConnector uri="tcp://localhost:0" />
        </amq:transportConnectors>
    </amq:broker>

   <!--  ActiveMQ destinations to use  -->
    <amq:queue id="wrappingQueue"  physicalName="wrappingQueue"/>
    <amq:queue id="replyToWrappingQueue" 
physicalName="replyToWrappingQueue"/>
    <amq:queue id="activationQueue"  physicalName="activationQueue"/>
    <amq:queue id="replyToActivationQueue" 
physicalName="replyToActivationQueue"/>

    <bean id="jmsFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">
                    <value>tcp://localhost:61616</value>
                </property>
            </bean>
        </property>
    </bean>

  <!-- Spring JMS Template -->
    <bean id="inviziJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <ref local="jmsFactory"/>
        </property>
    </bean>
    <bean id="consumerJmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="jmsFactory"/>
    </bean>

    <!-- Wrapping Queue sender and receiver -->
    <bean id="wrappingQueueSenderService"
class="com.inviziads.app.service.impl.WrappingQueueSenderServiceImpl">
        <property name="jmsTemplate">
            <ref bean="inviziJmsTemplate" />
        </property>
        <property name="destination">
            <ref bean="wrappingQueue"/>
        </property>
        <property name="replyTo">
            <ref bean="replyToWrappingQueue"/>
        </property>
    </bean>
    <bean id="wrappingQueueMessageListener"
class="com.inviziads.app.service.impl.WrappingQueueReceiverServiceImpl">
        <constructor-arg ref="alertDao" />
    </bean>

    <!-- and this is the message listener container -->
    <bean id="wrappingQueueJmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="jmsFactory"/>
        <property name="destination" ref="replyToWrappingQueue"/>
        <property name="messageListener" ref="wrappingQueueMessageListener"
/>
    </bean>
    
    <!-- Activation Queue sender and receiver -->
    <bean id="activationQueueSenderService"
class="com.inviziads.app.service.impl.ActivationQueueSenderServiceImpl">
        <property name="jmsTemplate">
            <ref bean="inviziJmsTemplate" />
        </property>
        <property name="destination">
            <ref bean="activationQueue"/>
        </property>
        <property name="replyTo">
            <ref bean="replyToActivationQueue"/>
        </property>
    </bean>
    <bean id="activationQueueMessageListener"
class="com.inviziads.app.service.impl.ActivationQueueReceiverServiceImpl">
        <constructor-arg ref="alertDao" />
    </bean>
    
    <!-- and this is the message listener container -->
    <bean id="activationQueueJmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="jmsFactory"/>
        <property name="destination" ref="replyToActivationQueue"/>
        <property name="messageListener"
ref="activationQueueMessageListener" />
    </bean>
>>

When I run the app using maven and jetty, I have no issues, everything is
fine.

However, when I build the war and drop it under tomcat6's webapp directory,
I get the follwoing error - 
<<
SEVERE: Exception sending context initialized event to listener instance of
class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'jmsFactory' defined in class path resource
[applicationContext-resources.xml]: Initialization of bean failed; nested
exception is java.lang.NoClassDefFoundError:
javax/transaction/TransactionManager
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
	at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
	at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
	at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
	at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
	at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
	at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>>

Apparantly, tomcat cannot find
org.apache.activemq.pool.PooledConnectionFactory. The war's lib does have
all the required libs like 
activation-1.1.jar
activeio-core-3.1.0.jar
activemq-5.1
activemq-core-5.1.0.jar
commons-logging-1.1.1.jar
geronimo-activation_1.1_spec-1.0.1.jar
geronimo-j2ee-management_1.0_spec-1.0.jar
geronimo-javamail_1.4_spec-1.2.jar
geronimo-jms_1.1_spec-1.1.1.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
spring-jms-2.5.4.jar
xbean-2.2.0.jar
xbean-spring-2.8.jar


I am guessing there is some more configurations required for Tomcat. Can
some one help me with this please?

Thanks in advance.
Aakhunaten

-- 
View this message in context: http://www.nabble.com/Tomcat6-%2B-Spring-2.5-%2B-ActiveMQ-tp20009978p20009978.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message