activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: org.jencks.pool.PooledSpringXAConnectionFactory without full Jencks JCA support
Date Tue, 08 Aug 2006 08:35:23 GMT
On 8/8/06, Eugene Prokopiev <prokopiev@stc.donpac.ru> wrote:
> Hi,
>
> Is it possible to use only
> org.jencks.pool.PooledSpringXAConnectionFactory without full Jencks JCA
> support for Spring Message Driven POJO?

No. I'd recommend not trying to implement your own version of JCA.


> I tried to use this context:
>
> <beans>
>
>         <bean id="broker" class="org.apache.activemq.broker.BrokerService"
> init-method="start" destroy-method="stop">
>                 <property name="persistent" value="false"/>
>                 <property name="transportConnectorURIs">
>                         <list>
>                                 <value>tcp://localhost:5000</value>
>                         </list>
>                 </property>
>         </bean>
>
>         <bean id="transactionContextManager"
> class="org.jencks.factory.TransactionContextManagerFactoryBean"/>
>         <bean id="geronimo"
> class="org.jencks.factory.GeronimoTransactionManagerFactoryBean"/>
>         <bean id="geronimoTransactionManager"
> class="org.springframework.transaction.jta.JtaTransactionManager">
>                 <property name="userTransaction" ref="geronimo" />
>         </bean>
>
>         <bean id="jmsFactory"
> class="org.apache.activemq.ActiveMQXAConnectionFactory">
>                 <property name="brokerURL" value="tcp://localhost:5000" />
>                 <property name="userName" value="dispatcher1" />
>                 <property name="password" value="dpwd1" />
>         </bean>
>         <bean id="jmsConnectionFactory"
> class="org.jencks.pool.PooledSpringXAConnectionFactory">
>                 <property name="connectionFactory" ref="jmsFactory"/>
>                 <property name="jtaTransactionManager" ref="geronimoTransactionManager"/>
>         </bean>
>         <bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
>                 <constructor-arg value="messages.input"/>
>         </bean>
>         <bean id="listenerContainer"
> class="org.springframework.jms.listener.DefaultMessageListenerContainer">
>                 <property name="concurrentConsumers" value="1"/>
>                 <property name="maxMessagesPerTask" value="1"/>
>                 <property name="connectionFactory" ref="jmsConnectionFactory"/>
>                 <property name="destination" ref="destination"/>
>                 <property name="messageListener" ref="myMessageListener"/>
>                 <property name="transactionManager" ref="geronimoTransactionManager"
/>
>         </bean>
>
>      <bean id="myMessageListener" class="manager.broker.MyMessageListener"/>
>
> </beans>
>
> On consuming message I got:
>
> INFO  CollectionFactory                - JDK 1.4+ collections available
> INFO  XmlBeanDefinitionReader          - Loading XML bean definitions
> from file [/home/john/workspace/AMQ/conf/manager-simple.xml]
> INFO  FileSystemXmlApplicationContext  - Bean factory for application
> context
> [org.springframework.context.support.FileSystemXmlApplicationContext;hashCode=12282550]:
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [broker,transactionContextManager,geronimo,geronimoTransactionManager,jmsFactory,jmsConnectionFactory,destination,listenerContainer,myMessageListener];
> root of BeanFactory hierarchy
> INFO  FileSystemXmlApplicationContext  - 9 beans defined in application
> context
> [org.springframework.context.support.FileSystemXmlApplicationContext;hashCode=12282550]
> INFO  FileSystemXmlApplicationContext  - Unable to locate MessageSource
> with name 'messageSource': using default
> [org.springframework.context.support.DelegatingMessageSource@388993]
> INFO  FileSystemXmlApplicationContext  - Unable to locate
> ApplicationEventMulticaster with name 'applicationEventMulticaster':
> using default
> [org.springframework.context.event.SimpleApplicationEventMulticaster@18aaa1e]
> INFO  DefaultListableBeanFactory       - Pre-instantiating singletons in
> factory
> [org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [broker,transactionContextManager,geronimo,geronimoTransactionManager,jmsFactory,jmsConnectionFactory,destination,listenerContainer,myMessageListener];
> root of BeanFactory hierarchy]
> INFO  BrokerService                    - ActiveMQ null JMS Message
> Broker (localhost) is starting
> INFO  BrokerService                    - For help or more information
> please see: http://incubator.apache.org/activemq/
> INFO  TransportServerThreadSupport     - Listening for connections at:
> tcp://prokopiev.stc.donpac.ru:5000
> INFO  TransportConnector               - Connector
> tcp://prokopiev.stc.donpac.ru:5000 Started
> INFO  BrokerService                    - ActiveMQ JMS Message Broker
> (localhost, ID:prokopiev.stc.donpac.ru-58620-1155025769955-0:0) started
> INFO  JtaTransactionManager            - Using JTA UserTransaction:
> org.apache.geronimo.transaction.context.GeronimoTransactionManager@1afae45
> INFO  JtaTransactionManager            - Using JTA TransactionManager:
> org.apache.geronimo.transaction.context.GeronimoTransactionManager@1afae45
> INFO  ManagementContext                - JMX consoles can connect to
> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
>
>
> ERROR DefaultMessageListenerContainer  - Execution of JMS message
> listener failed
> javax.jms.JMSException: Session's XAResource has not been enlisted in a
> distributed transaction.
>         at
> org.apache.activemq.ActiveMQXASession.doStartTransaction(ActiveMQXASession.java:109)
>         at
> org.apache.activemq.ActiveMQMessageConsumer.ackLater(ActiveMQMessageConsumer.java:658)
>         at
> org.apache.activemq.ActiveMQMessageConsumer.beforeMessageIsConsumed(ActiveMQMessageConsumer.java:610)
>         at
> org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:469)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer.doExecuteListener(DefaultMessageListenerContainer.java:301)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$1.doInTransactionWithoutResult(DefaultMessageListenerContainer.java:278)
>         at
> org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
>         at
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer.executeListener(DefaultMessageListenerContainer.java:275)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:375)
>         at
> org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottlingRunnable.run(SimpleAsyncTaskExecutor.java:203)
>         at java.lang.Thread.run(Thread.java:595)
>
> How can I enlist session in distributed transaction without JCA?
>
> --
> Thanks,
> Eugene Prokopiev
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message