You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by drieselliott <dr...@xt-i.com> on 2014/11/26 11:17:59 UTC

Tomee throws 'Not a transacted session'

Hi,

I configured JMS using the Spring message listener container, I set the
property sessionTransacted to 'true'. I'm getting the following stacktrace:

<pre>
org.springframework.jms.connection.SynchedLocalTransactionFailedException:
Local JMS transaction failed to commit; nested exception is
javax.jms.IllegalStateException: Not a transacted session
	at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:407)
	at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:389)
	at
org.springframework.transaction.support.ResourceHolderSynchronization.afterCommit(ResourceHolderSynchronization.java:79)
	at
org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133)
	at
org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121)
	at
org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:951)
	at
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:797)
	at
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
	at
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
	at
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270)
	at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
	at com.verizon.iam.rma.aop.AuditAspect.auditCall(AuditAspect.java:73)
	at com.verizon.iam.rma.aop.AuditAspect.audit(AuditAspect.java:55)
	at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
	at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
	at
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy300.invite(Unknown Source)
	at
com.verizon.iam.rma.rest.RoleInvitationsResourceImpl.invite(RoleInvitationsResourceImpl.java:43)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
	at
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
	at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
	at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
	at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
	at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
	at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
	at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:744)
Caused by: javax.jms.IllegalStateException: Not a transacted session
	at org.apache.activemq.ActiveMQSession.commit(ActiveMQSession.java:569)
	at
org.apache.activemq.ra.ManagedSessionProxy.commit(ManagedSessionProxy.java:108)
	at
org.springframework.jms.connection.JmsResourceHolder.commitAll(JmsResourceHolder.java:184)
	at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:404)
	... 62 more
</pre>

Any ideas?

Thanks,

Dries



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

How do you get the session? Are you sure the connection factory you
get is the XA one?

I think the best is to share a sample cause looking the stack trace it
seems you don't use an XA connection factory.


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-12-06 3:13 GMT+01:00 Trevor Stevens <ts...@me.com>:
> I have been working on a similar issue recently which we cannot get our head around. Using this thread and http://tomee-openejb.979440.n4.nabble.com/MDB-doesn-t-read-messages-td4666169.html we have been able to reliably reproduce the failure within a sample project. I will be trying to get the sample project up on github sometime this weekend.
>
> We were able to get TomEE to start using the ActiveMQXAConnectionFactory but that still resulted in the same problems. We have tried multiple configurations to try and figure this out but nothing has worked. In our sample we are sending messages and saving to a database within a transactional method, our expectation is that both should proceed only after the XA translation is committed but that is not the result we are getting. Currently we are seeing messages sending to the queues _before_ the method completes which should never happen while using XA if the transaction is uncommitted. If we have a listener on the queue which attempts to read the object saved to the database in the producer we get issues. Specifically, the previous XA transaction has yet to close so the database writes are not committed and therefore unavailable to be read within the subsequent listener.
>
> More detail here http://stackoverflow.com/questions/27325977/spring-tomee-jta-transactions from a coworker but including some configuration below for this chain. Any ideas as to what could be going wrong here?
>
> tomee.xml:
> <Resource id="TomEEJmsResourceAdapter" type="ActiveMQResourceAdapter">
>     BrokerXmlConfig =  broker:(vm://localhost)
>     ServerUrl       =  vm://localhost
> </Resource>
>
> <Resource id="resources/jms/XAConnectionFactory" class-name="org.apache.activemq.ActiveMQXAConnectionFactory">
>     ResourceAdapter = TomEEJmsResourceAdapter
> </Resource>
>
> <Resource id="PrintQueue" type="javax.jms.Queue"/>
>
> <Resource id="MySQL Database" type="DataSource">
>     JdbcDriver  com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>     JdbcUrl jdbc:mysql://localhost/test
>     UserName    test
> </Resource>
>
>
> Spring config:
> <bean id="printQueue" class="org.springframework.jms.core.JmsTemplate">
>     <property name="connectionFactory">
>         <ref local="jmsFactory" />
>     </property>
>     <property name="defaultDestinationName" value="printQueue" />
>     <property name="deliveryPersistent" value="true"/>
>     <!-- <property name="sessionTransacted" value="true"/> -->
>     <property name="explicitQosEnabled" value="true"/>
> </bean>
>
> <jms:listener-container container-type="default" connection-factory="jmsFactory" cache="none" acknowledge="transacted" transaction-manager="transactionManager" concurrency="1" >
>     <jms:listener destination="printQueue" ref="printListener"/>
> </jms:listener-container>
>
> Trevor Stevens
> tstevens@me.com
>
>
>> On Dec 2, 2014, at 7:40 AM, Romain Manni-Bucau <rm...@gmail.com> wrote:
>>
>> I have to admit I never used this one but here some randoms thoughts:
>> 1) packaging/binaries: try putting spring + AMQ in tomee/lib and check
>> you still have the issue
>> 1bis) ensure you don't deliver APIs which could conflicts with tomee
>> (jms and jta ones for instance)
>> 2) init in a wrong context
>>
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>
>>
>> 2014-12-02 13:25 GMT+01:00 drieselliott <dr...@xt-i.com>:
>>> Hi,
>>>
>>> When I switch to an ActiveMQXAConnectionFactory TomEE crashes. The
>>> ConnectionFactory is possibly causing the strange behaviour we are
>>> encountering.
>>>
>>> Do you have any ideas why TomEE can't start when I define this resource?
>>>
>>> Kind regards,
>>>
>>> Dries
>>>
>>>
>>>
>>> --
>>> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673106.html
>>> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Tomee throws 'Not a transacted session'

Posted by Trevor Stevens <ts...@me.com>.
I have been working on a similar issue recently which we cannot get our head around. Using this thread and http://tomee-openejb.979440.n4.nabble.com/MDB-doesn-t-read-messages-td4666169.html we have been able to reliably reproduce the failure within a sample project. I will be trying to get the sample project up on github sometime this weekend. 

We were able to get TomEE to start using the ActiveMQXAConnectionFactory but that still resulted in the same problems. We have tried multiple configurations to try and figure this out but nothing has worked. In our sample we are sending messages and saving to a database within a transactional method, our expectation is that both should proceed only after the XA translation is committed but that is not the result we are getting. Currently we are seeing messages sending to the queues _before_ the method completes which should never happen while using XA if the transaction is uncommitted. If we have a listener on the queue which attempts to read the object saved to the database in the producer we get issues. Specifically, the previous XA transaction has yet to close so the database writes are not committed and therefore unavailable to be read within the subsequent listener.

More detail here http://stackoverflow.com/questions/27325977/spring-tomee-jta-transactions from a coworker but including some configuration below for this chain. Any ideas as to what could be going wrong here?

tomee.xml:
<Resource id="TomEEJmsResourceAdapter" type="ActiveMQResourceAdapter">
    BrokerXmlConfig =  broker:(vm://localhost) 
    ServerUrl       =  vm://localhost
</Resource>

<Resource id="resources/jms/XAConnectionFactory" class-name="org.apache.activemq.ActiveMQXAConnectionFactory"> 
    ResourceAdapter = TomEEJmsResourceAdapter 
</Resource> 

<Resource id="PrintQueue" type="javax.jms.Queue"/>

<Resource id="MySQL Database" type="DataSource">
    JdbcDriver  com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
    JdbcUrl jdbc:mysql://localhost/test
    UserName    test
</Resource>


Spring config:
<bean id="printQueue" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
        <ref local="jmsFactory" />
    </property>
    <property name="defaultDestinationName" value="printQueue" />
    <property name="deliveryPersistent" value="true"/>
    <!-- <property name="sessionTransacted" value="true"/> -->
    <property name="explicitQosEnabled" value="true"/>
</bean>

<jms:listener-container container-type="default" connection-factory="jmsFactory" cache="none" acknowledge="transacted" transaction-manager="transactionManager" concurrency="1" >
    <jms:listener destination="printQueue" ref="printListener"/>
</jms:listener-container>

Trevor Stevens
tstevens@me.com


> On Dec 2, 2014, at 7:40 AM, Romain Manni-Bucau <rm...@gmail.com> wrote:
> 
> I have to admit I never used this one but here some randoms thoughts:
> 1) packaging/binaries: try putting spring + AMQ in tomee/lib and check
> you still have the issue
> 1bis) ensure you don't deliver APIs which could conflicts with tomee
> (jms and jta ones for instance)
> 2) init in a wrong context
> 
> 
> 
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
> 
> 
> 2014-12-02 13:25 GMT+01:00 drieselliott <dr...@xt-i.com>:
>> Hi,
>> 
>> When I switch to an ActiveMQXAConnectionFactory TomEE crashes. The
>> ConnectionFactory is possibly causing the strange behaviour we are
>> encountering.
>> 
>> Do you have any ideas why TomEE can't start when I define this resource?
>> 
>> Kind regards,
>> 
>> Dries
>> 
>> 
>> 
>> --
>> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673106.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.


Re: Tomee throws 'Not a transacted session'

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I have to admit I never used this one but here some randoms thoughts:
1) packaging/binaries: try putting spring + AMQ in tomee/lib and check
you still have the issue
1bis) ensure you don't deliver APIs which could conflicts with tomee
(jms and jta ones for instance)
2) init in a wrong context



Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-12-02 13:25 GMT+01:00 drieselliott <dr...@xt-i.com>:
> Hi,
>
> When I switch to an ActiveMQXAConnectionFactory TomEE crashes. The
> ConnectionFactory is possibly causing the strange behaviour we are
> encountering.
>
> Do you have any ideas why TomEE can't start when I define this resource?
>
> Kind regards,
>
> Dries
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673106.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by drieselliott <dr...@xt-i.com>.
Hi,

When I switch to an ActiveMQXAConnectionFactory TomEE crashes. The
ConnectionFactory is possibly causing the strange behaviour we are
encountering.

Do you have any ideas why TomEE can't start when I define this resource?

Kind regards,

Dries



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673106.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by Romain Manni-Bucau <rm...@gmail.com>.
do you hide an exception?


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-12-01 10:04 GMT+01:00 drieselliott <dr...@xt-i.com>:
> Hi,
>
> I've tried to reproduce this issue in a Github project:
>
> Jms Test <https://github.com/drieselliott/jmstest>
>
> I'm not able to recreate the issue in this project. It seems that in the
> real project there is something else that causes the transaction to fail
> unexpectedly.
>
> Do you have any other ideas concerning what may cause this behaviour?
>
> Kind regards,
>
> Dries
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673090.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by drieselliott <dr...@xt-i.com>.
Hi,

I've tried to reproduce this issue in a Github project:

Jms Test <https://github.com/drieselliott/jmstest>  

I'm not able to recreate the issue in this project. It seems that in the
real project there is something else that causes the transaction to fail
unexpectedly.

Do you have any other ideas concerning what may cause this behaviour?

Kind regards,

Dries



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673090.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by Romain Manni-Bucau <rm...@gmail.com>.
looks ok, are you able to package/share a sample (github would be appreciated)


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-11-26 12:43 GMT+01:00 drieselliott <dr...@xt-i.com>:
> I use the code below to create my JmsTemplate:
>
>     JmsTemplate jmsTemplate = jmsTemplate;
>     jmsTemplate.setSessionTransacted(true);
>     jmsTemplate.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
>
> The message listener container is configured like this:
>
>     DefaultMessageListenerContainer mailQueueListenerContainer = new
> DefaultMessageListenerContainer();
>     mailQueueListenerContainer.setConnectionFactory(connectionFactory);
>     mailQueueListenerContainer.setDestination(queue);
>       mailQueueListenerContainer.setMessageListener(new
> AsyncMailSender(mailSender(), fromAddress));
>       mailQueueListenerContainer.setConcurrentConsumers(10);
>       mailQueueListenerContainer.setMaxConcurrentConsumers(20);
>     mailQueueListenerContainer.setTransactionManager(transactionManager);
>     mailQueueListenerContainer.setSessionTransacted(true);
>
> mailQueueListenerContainer.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
>
> Is there anything else I'm missing?
>
> Kind regards,
>
> Dries
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673034.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by drieselliott <dr...@xt-i.com>.
I use the code below to create my JmsTemplate:

    JmsTemplate jmsTemplate = jmsTemplate;
    jmsTemplate.setSessionTransacted(true);
    jmsTemplate.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);

The message listener container is configured like this:

    DefaultMessageListenerContainer mailQueueListenerContainer = new
DefaultMessageListenerContainer();
    mailQueueListenerContainer.setConnectionFactory(connectionFactory);
    mailQueueListenerContainer.setDestination(queue);
      mailQueueListenerContainer.setMessageListener(new
AsyncMailSender(mailSender(), fromAddress));
      mailQueueListenerContainer.setConcurrentConsumers(10);
      mailQueueListenerContainer.setMaxConcurrentConsumers(20);
    mailQueueListenerContainer.setTransactionManager(transactionManager);
    mailQueueListenerContainer.setSessionTransacted(true);
   
mailQueueListenerContainer.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);

Is there anything else I'm missing?

Kind regards,

Dries



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673034.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by Romain Manni-Bucau <rm...@gmail.com>.
This is in your (or spring) code, not in config


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-11-26 11:54 GMT+01:00 drieselliott <dr...@xt-i.com>:
> I tried setting an acknowledge mode, but that doesn't seem to help.
>
> This is my tomee.xml snippet in which I configure the message queue:
>
>     <Resource id="JmsResourceAdapter" type="ActiveMQResourceAdapter"/>
>
>   <Resource id="XAConnectionFactory" type="javax.jms.ConnectionFactory">
>     ResourceAdapter     JmsResourceAdapter
>     TransactionSupport  xa
>     PoolMinSize         0
>     PoolMaxSize         10
>   </Resource>
>
>   <Resource id="MailQueue" type="javax.jms.Queue">
>     Destination         MailQueue
>   </Resource>
>
> I'm trying to use XA transactions.
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673031.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by drieselliott <dr...@xt-i.com>.
I tried setting an acknowledge mode, but that doesn't seem to help.

This is my tomee.xml snippet in which I configure the message queue:

    <Resource id="JmsResourceAdapter" type="ActiveMQResourceAdapter"/>

  <Resource id="XAConnectionFactory" type="javax.jms.ConnectionFactory">
    ResourceAdapter     JmsResourceAdapter
    TransactionSupport  xa
    PoolMinSize         0
    PoolMaxSize         10
  </Resource>

  <Resource id="MailQueue" type="javax.jms.Queue">
    Destination         MailQueue
  </Resource>

I'm trying to use XA transactions.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029p4673031.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Tomee throws 'Not a transacted session'

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

did you use transacted acknowledgeMode creating the session?


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-11-26 11:17 GMT+01:00 drieselliott <dr...@xt-i.com>:
> Hi,
>
> I configured JMS using the Spring message listener container, I set the
> property sessionTransacted to 'true'. I'm getting the following stacktrace:
>
> <pre>
> org.springframework.jms.connection.SynchedLocalTransactionFailedException:
> Local JMS transaction failed to commit; nested exception is
> javax.jms.IllegalStateException: Not a transacted session
>         at
> org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:407)
>         at
> org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:389)
>         at
> org.springframework.transaction.support.ResourceHolderSynchronization.afterCommit(ResourceHolderSynchronization.java:79)
>         at
> org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133)
>         at
> org.springframework.transaction.support.TransactionSynchronizationUtils.triggerAfterCommit(TransactionSynchronizationUtils.java:121)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCommit(AbstractPlatformTransactionManager.java:951)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:797)
>         at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
>         at
> org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
>         at
> org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270)
>         at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
>         at com.verizon.iam.rma.aop.AuditAspect.auditCall(AuditAspect.java:73)
>         at com.verizon.iam.rma.aop.AuditAspect.audit(AuditAspect.java:55)
>         at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
>         at
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
>         at
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com.sun.proxy.$Proxy300.invite(Unknown Source)
>         at
> com.verizon.iam.rma.rest.RoleInvitationsResourceImpl.invite(RoleInvitationsResourceImpl.java:43)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
> org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
>         at
> org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
>         at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
>         at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
>         at
> org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
>         at
> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
>         at
> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
>         at
> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
>         at
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
>         at
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>         at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
>         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
>         at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
>         at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
>         at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>         at java.lang.Thread.run(Thread.java:744)
> Caused by: javax.jms.IllegalStateException: Not a transacted session
>         at org.apache.activemq.ActiveMQSession.commit(ActiveMQSession.java:569)
>         at
> org.apache.activemq.ra.ManagedSessionProxy.commit(ManagedSessionProxy.java:108)
>         at
> org.springframework.jms.connection.JmsResourceHolder.commitAll(JmsResourceHolder.java:184)
>         at
> org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:404)
>         ... 62 more
> </pre>
>
> Any ideas?
>
> Thanks,
>
> Dries
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Tomee-throws-Not-a-transacted-session-tp4673029.html
> Sent from the TomEE Users mailing list archive at Nabble.com.