You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mark Borner <ma...@zurich.com.au> on 2011/03/30 07:05:42 UTC
Using JPA and JMS Endpoints with XA Transactions on Websphere
Hi all:
I have a route which works, but keeps spitting out messages in the
Websphere log. The route is:
from("jpa:au.com.zurich.phoenix.i90.entity.ExportMessage
?consumeDelete=false&transactionManager=#transactionManager&consumer.delay=30000&consumer.nativeQuery="
+ SQL)
.routeId("ExportQueueProducerRoute")
.startupOrder(550)
.transacted()
.to("bean:exportMessageDao?method=process")
.log(LoggingLevel.INFO, "Putting export message on queue.
Id=${in.header." + INTERNAL_ID + "}")
.to(ExchangePattern.InOnly,
"jms:queue:GITC.GTWY.EXPORT.MARK?connectionFactory=#connectionFactory&transactionManager=#transactionManager&transacted=true&cacheLevelName=CACHE_NONE"
);
In essence, I'm reading from the database using a JPA endpoint and I'm
putting the records onto a queue using a JMS endpoint, and I'd like to
happen within an XA transaction.
The error is (it comes out twice):
[30/03/11 15:18:24:871 EST] 00000039 ConnectionEve W J2CA0206W: A
connection error occurred. To help determine the problem, enable the
Diagnose Connection Usage option on the Connection Factory or Data Source.
[30/03/11 15:18:25:043 EST] 00000039 ConnectionEve A J2CA0056I: The
Connection Manager received a fatal connection error from the Resource
Adapter for resource JMS$I90 Gateway$JMSManagedConnection@0. The exception
is: com.ibm.msg.client.jms.DetailedTransactionInProgressException:
JMSCC1069: The operation for an XA transacted session was not valid. The
acknowledgement mode for a transacted session was not valid. Commit(),
rollback(), acknowledge() and recover() are not valid operations in
transacted sessions. Do not call these method when using XA.
[30/03/11 15:18:25:074 EST] 00000039 ConnectionEve W J2CA0206W: A
connection error occurred. To help determine the problem, enable the
Diagnose Connection Usage option on the Connection Factory or Data Source.
[30/03/11 15:18:25:074 EST] 00000039 ConnectionEve A J2CA0056I: The
Connection Manager received a fatal connection error from the Resource
Adapter for resource jms/conn/i90/gtwy. The exception is:
com.ibm.msg.client.jms.DetailedTransactionInProgressException: JMSCC1069:
The operation for an XA transacted session was not valid. The
acknowledgement mode for a transacted session was not valid. Commit(),
rollback(), acknowledge() and recover() are not valid operations in
transacted sessions. Do not call these method when using XA.
[30/03/11 15:18:25:292 EST] 00000039 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on
E:\logs\was7\phoenix\ffdc\server1_36933693_11.03.30_15.18.25.1678686577991981790876.txt
com.ibm.ejs.jms.JMSSessionHandle.commit 505
The FFDC stack trace is:
[30/03/11 15:18:25:199 EST] FFDC
Exception:com.ibm.msg.client.jms.DetailedTransactionInProgressException
SourceId:com.ibm.ejs.jms.JMSSessionHandle.commit ProbeId:505
Reporter:com.ibm.ejs.jms.JMSSessionHandle@26492649
com.ibm.msg.client.jms.DetailedTransactionInProgressException: JMSCC1069:
The operation for an XA transacted session was not valid. The
acknowledgement mode for a transacted session was not valid. Commit(),
rollback(), acknowledge() and recover() are not valid operations in
transacted sessions. Do not call these method when using XA.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:516)
at
com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:313)
at
com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:388)
at
com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104)
at
com.ibm.msg.client.jms.internal.JmsXASessionImpl.commit(JmsXASessionImpl.java:500)
at
com.ibm.msg.client.jms.internal.JmsXASessionImpl$1.commit(JmsXASessionImpl.java:310)
at com.ibm.mq.jms.MQSession.commit(MQSession.java:214)
at
com.ibm.ejs.jms.JMSSessionHandle.commit(JMSSessionHandle.java:696)
at
com.ibm.ejs.jms.JMSSessionHandle.commit(JMSSessionHandle.java:649)
at
org.springframework.jms.connection.JmsResourceHolder.commitAll(JmsResourceHolder.java:181)
at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:404)
at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:1)
at
org.springframework.transaction.support.ResourceHolderSynchronization.afterCommit(ResourceHolderSynchronization.java:79)
at
org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133)
at
org.springframework.transaction.jta.JtaAfterCompletionSynchronization.afterCompletion(JtaAfterCompletionSynchronization.java:59)
at
com.ibm.ws.uow.ComponentContextSynchronizationWrapper.afterCompletion(ComponentContextSynchronizationWrapper.java:83)
at
com.ibm.tx.jta.RegisteredSyncs.coreDistributeAfter(RegisteredSyncs.java:357)
at
com.ibm.ws.tx.jta.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:317)
at
com.ibm.tx.jta.TransactionImpl.distributeAfter(TransactionImpl.java:2940)
at
com.ibm.tx.jta.TransactionImpl.postCompletion(TransactionImpl.java:2899)
at
com.ibm.tx.jta.TransactionImpl.internalCommit(TransactionImpl.java:1866)
at
com.ibm.tx.jta.TransactionImpl.internalCommit(TransactionImpl.java:1841)
at
com.ibm.tx.jta.TransactionImpl.coreStage2CommitProcessing(TransactionImpl.java:1088)
at
com.ibm.tx.jta.TransactionImpl.stage2CommitProcessing(TransactionImpl.java:1126)
at
com.ibm.tx.jta.TransactionImpl.processCommit(TransactionImpl.java:987)
at com.ibm.tx.jta.TransactionImpl.commit(TransactionImpl.java:918)
at
com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:377)
at com.ibm.tx.jta.TranManagerSet.commit(TranManagerSet.java:161)
at
com.ibm.ws.uow.UOWManagerImpl.uowCommit(UOWManagerImpl.java:1176)
at com.ibm.ws.uow.UOWManagerImpl.uowEnd(UOWManagerImpl.java:1146)
at
com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:1094)
at
com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:628)
at
org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:281)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:124)
at
org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78)
at
org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:79)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:453)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:329)
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:162)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:110)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:193)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:217)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:898)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:920)
at java.lang.Thread.run(Thread.java:736)
at
au.com.zurich.phoenix.camel.strategy.WebsphereExecutorServiceStrategy$WasWork.run(WebsphereExecutorServiceStrategy.java:317)
at
com.ibm.ws.asynchbeans.J2EEContext$RunProxy.run(J2EEContext.java:264)
at
java.security.AccessController.doPrivileged(AccessController.java:202)
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1137)
at
com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:199)
at
com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:188)
at java.lang.Thread.run(Thread.java:736)
From the stack trace, it is the JPA Consumer's commit that is trying to
commit the XA transaction. But, I'm not sure why it fails in the JMS
connection. Any help is appreciated!
Thanks,
Mark
Mark Borner
Java Developer - ZStream Xpress
----
This email is intended for the named recipient only. It may contain
information which is confidential, commercially sensitive, or
copyright. If you are not the intended recipient you must not
reproduce or distribute any part of the email, disclose its contents,
or take any action in reliance. If you have received this email in
error, please contact the sender and delete the message. It is your
responsibility to scan this email and any attachments for viruses and
other defects. To the extent permitted by law, Zurich and its
associates will not be liable for any loss or damage arising in any
way from this communication including any file attachments. We may
monitor email you send to us, either as a reply to this email or any
email you send to us, to confirm our systems are protected and for
compliance with company policies. Although we take reasonable
precautions to protect the confidentiality of our email systems, we
do not warrant the confidentiality or security of email or
attachments we receive.
Re: Using JPA and JMS Endpoints with XA Transactions on Websphere
Posted by Mark Borner <ma...@zurich.com.au>.
Hi all:
I figured this one out.....
I found this javadoc on Spring's JMSAccessor class:
/**
* Set the transaction mode that is used when creating a JMS
{@link Session}.
* Default is "false".
* <p>Note that within a JTA transaction, the parameters passed to
* <code>create(Queue/Topic)Session(boolean transacted, int
acknowledgeMode)</code>
* method are not taken into account. Depending on the J2EE
transaction context,
* the container makes its own decisions on these values.
Analogously, these
* parameters are not taken into account within a locally managed
transaction
* either, since the accessor operates on an existing JMS Session
in this case.
* <p>Setting this flag to "true" will use a short local JMS
transaction
* when running outside of a managed transaction, and a
synchronized local
* JMS transaction in case of a managed transaction (other than an
XA
* transaction) being present. The latter has the effect of a
local JMS
* transaction being managed alongside the main transaction (which
might
* be a native JDBC transaction), with the JMS transaction
committing
* right after the main transaction.
* @see javax.jms.Connection#createSession(boolean, int)
*/
public void setSessionTransacted(boolean sessionTransacted) {
this.sessionTransacted = sessionTransacted;
}
All I did to fix the error is to remove the "&transacted=true" from my
queue definition!
Thanks,
Mark
Mark Borner
Java Developer - ZStream Xpress
From:
Mark Borner <ma...@zurich.com.au>
To:
users <us...@camel.apache.org>
Date:
30/03/2011 04:06 PM
Subject:
Using JPA and JMS Endpoints with XA Transactions on Websphere
Hi all:
I have a route which works, but keeps spitting out messages in the
Websphere log. The route is:
from("jpa:au.com.zurich.phoenix.i90.entity.ExportMessage?consumeDelete=false&transactionManager=#transactionManager&consumer.delay=30000&consumer.nativeQuery="
+ SQL)
.routeId("ExportQueueProducerRoute")
.startupOrder(550)
.transacted()
.to("bean:exportMessageDao?method=process")
.log(LoggingLevel.INFO, "Putting export message on queue.
Id=${in.header." + INTERNAL_ID + "}")
.to(ExchangePattern.InOnly,
"jms:queue:GITC.GTWY.EXPORT.MARK?connectionFactory=#connectionFactory&transactionManager=#transactionManager&transacted=true&cacheLevelName=CACHE_NONE");
In essence, I'm reading from the database using a JPA endpoint and I'm
putting the records onto a queue using a JMS endpoint, and I'd like to
happen within an XA transaction.
The error is (it comes out twice):
[30/03/11 15:18:24:871 EST] 00000039 ConnectionEve W J2CA0206W: A
connection error occurred. To help determine the problem, enable the
Diagnose Connection Usage option on the Connection Factory or Data Source.
[30/03/11 15:18:25:043 EST] 00000039 ConnectionEve A J2CA0056I: The
Connection Manager received a fatal connection error from the Resource
Adapter for resource JMS$I90 Gateway$JMSManagedConnection@0. The exception
is: com.ibm.msg.client.jms.DetailedTransactionInProgressException:
JMSCC1069: The operation for an XA transacted session was not valid. The
acknowledgement mode for a transacted session was not valid. Commit(),
rollback(), acknowledge() and recover() are not valid operations in
transacted sessions. Do not call these method when using XA.
[30/03/11 15:18:25:074 EST] 00000039 ConnectionEve W J2CA0206W: A
connection error occurred. To help determine the problem, enable the
Diagnose Connection Usage option on the Connection Factory or Data Source.
[30/03/11 15:18:25:074 EST] 00000039 ConnectionEve A J2CA0056I: The
Connection Manager received a fatal connection error from the Resource
Adapter for resource jms/conn/i90/gtwy. The exception is:
com.ibm.msg.client.jms.DetailedTransactionInProgressException: JMSCC1069:
The operation for an XA transacted session was not valid. The
acknowledgement mode for a transacted session was not valid. Commit(),
rollback(), acknowledge() and recover() are not valid operations in
transacted sessions. Do not call these method when using XA.
[30/03/11 15:18:25:292 EST] 00000039 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on
E:\logs\was7\phoenix\ffdc\server1_36933693_11.03.30_15.18.25.1678686577991981790876.txt
com.ibm.ejs.jms.JMSSessionHandle.commit 505
The FFDC stack trace is:
[30/03/11 15:18:25:199 EST] FFDC
Exception:com.ibm.msg.client.jms.DetailedTransactionInProgressException
SourceId:com.ibm.ejs.jms.JMSSessionHandle.commit ProbeId:505
Reporter:com.ibm.ejs.jms.JMSSessionHandle@26492649
com.ibm.msg.client.jms.DetailedTransactionInProgressException: JMSCC1069:
The operation for an XA transacted session was not valid. The
acknowledgement mode for a transacted session was not valid. Commit(),
rollback(), acknowledge() and recover() are not valid operations in
transacted sessions. Do not call these method when using XA.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:516)
at
com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:313)
at
com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:388)
at
com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104)
at
com.ibm.msg.client.jms.internal.JmsXASessionImpl.commit(JmsXASessionImpl.java:500)
at
com.ibm.msg.client.jms.internal.JmsXASessionImpl$1.commit(JmsXASessionImpl.java:310)
at com.ibm.mq.jms.MQSession.commit(MQSession.java:214)
at
com.ibm.ejs.jms.JMSSessionHandle.commit(JMSSessionHandle.java:696)
at
com.ibm.ejs.jms.JMSSessionHandle.commit(JMSSessionHandle.java:649)
at
org.springframework.jms.connection.JmsResourceHolder.commitAll(JmsResourceHolder.java:181)
at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:404)
at
org.springframework.jms.connection.ConnectionFactoryUtils$JmsResourceSynchronization.processResourceAfterCommit(ConnectionFactoryUtils.java:1)
at
org.springframework.transaction.support.ResourceHolderSynchronization.afterCommit(ResourceHolderSynchronization.java:79)
at
org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCommit(TransactionSynchronizationUtils.java:133)
at
org.springframework.transaction.jta.JtaAfterCompletionSynchronization.afterCompletion(JtaAfterCompletionSynchronization.java:59)
at
com.ibm.ws.uow.ComponentContextSynchronizationWrapper.afterCompletion(ComponentContextSynchronizationWrapper.java:83)
at
com.ibm.tx.jta.RegisteredSyncs.coreDistributeAfter(RegisteredSyncs.java:357)
at
com.ibm.ws.tx.jta.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:317)
at
com.ibm.tx.jta.TransactionImpl.distributeAfter(TransactionImpl.java:2940)
at
com.ibm.tx.jta.TransactionImpl.postCompletion(TransactionImpl.java:2899)
at
com.ibm.tx.jta.TransactionImpl.internalCommit(TransactionImpl.java:1866)
at
com.ibm.tx.jta.TransactionImpl.internalCommit(TransactionImpl.java:1841)
at
com.ibm.tx.jta.TransactionImpl.coreStage2CommitProcessing(TransactionImpl.java:1088)
at
com.ibm.tx.jta.TransactionImpl.stage2CommitProcessing(TransactionImpl.java:1126)
at
com.ibm.tx.jta.TransactionImpl.processCommit(TransactionImpl.java:987)
at com.ibm.tx.jta.TransactionImpl.commit(TransactionImpl.java:918)
at
com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:377)
at com.ibm.tx.jta.TranManagerSet.commit(TranManagerSet.java:161)
at
com.ibm.ws.uow.UOWManagerImpl.uowCommit(UOWManagerImpl.java:1176)
at com.ibm.ws.uow.UOWManagerImpl.uowEnd(UOWManagerImpl.java:1146)
at
com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:1094)
at
com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:628)
at
org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:281)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:124)
at
org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78)
at
org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:79)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:453)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:329)
at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:162)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:110)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:193)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:217)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:898)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:920)
at java.lang.Thread.run(Thread.java:736)
at
au.com.zurich.phoenix.camel.strategy.WebsphereExecutorServiceStrategy$WasWork.run(WebsphereExecutorServiceStrategy.java:317)
at
com.ibm.ws.asynchbeans.J2EEContext$RunProxy.run(J2EEContext.java:264)
at
java.security.AccessController.doPrivileged(AccessController.java:202)
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1137)
at
com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:199)
at
com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:188)
at java.lang.Thread.run(Thread.java:736)
From the stack trace, it is the JPA Consumer's commit that is trying to
commit the XA transaction. But, I'm not sure why it fails in the JMS
connection. Any help is appreciated!
Thanks,
Mark
Mark Borner
Java Developer - ZStream Xpress
----
This email is intended for the named recipient only. It may contain
information which is confidential, commercially sensitive, or
copyright. If you are not the intended recipient you must not
reproduce or distribute any part of the email, disclose its contents,
or take any action in reliance. If you have received this email in
error, please contact the sender and delete the message. It is your
responsibility to scan this email and any attachments for viruses and
other defects. To the extent permitted by law, Zurich and its
associates will not be liable for any loss or damage arising in any
way from this communication including any file attachments. We may
monitor email you send to us, either as a reply to this email or any
email you send to us, to confirm our systems are protected and for
compliance with company policies. Although we take reasonable
precautions to protect the confidentiality of our email systems, we
do not warrant the confidentiality or security of email or
attachments we receive.
----
This email is intended for the named recipient only. It may contain
information which is confidential, commercially sensitive, or
copyright. If you are not the intended recipient you must not
reproduce or distribute any part of the email, disclose its contents,
or take any action in reliance. If you have received this email in
error, please contact the sender and delete the message. It is your
responsibility to scan this email and any attachments for viruses and
other defects. To the extent permitted by law, Zurich and its
associates will not be liable for any loss or damage arising in any
way from this communication including any file attachments. We may
monitor email you send to us, either as a reply to this email or any
email you send to us, to confirm our systems are protected and for
compliance with company policies. Although we take reasonable
precautions to protect the confidentiality of our email systems, we
do not warrant the confidentiality or security of email or
attachments we receive.