Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been experimenting with WS-Atomic Transaction for a number of years now, though none of that work has made it past the POC stages...until now. Then, recently I've started working on a web service that made use of WS-AT to ensure that data was committed atomically between two distinct products in the stack, both of which were running in separate WebLogic managed servers. Everything was going just fine until we enabled the use of TransactionalFeature on the web service proxies and all hell broke loose...

None of the WS-AT enabled web service calls would work and failed with the following exception...
 Error
weblogic.transaction.RollbackException : Could not prepare resource '0BI_WSATGatewayRMxxxx
Failed state during prepare of WS-AT XAResource:WSATXAResource: xidBEA1-xxxx status:Aborted epr:<?xml version="1.0" encoding="UTF-8"?>
<ns0:EndpointReference xmlns:ns0="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ns0:Address>http://1.1.1.1:1111/wls-wsat/ParticipantPortType</ns0:Address><ns0:ReferenceParameters><wls-wsat:txId xmlns:wls-wsat="http://weblogic.wsee.wstx.wsat/ws/2008/10/wsat">FF1D-xxxx</wls-wsat:txId><wls-wsat:routing xmlns:wls-wsat="http://weblogic.wsee.wstx.wsat/ws/2008/10/wsat">WLS_xxxx</wls-wsat:routing></ns0:ReferenceParameters></ns0:EndpointReference> isRemovedFromMap:false
at org.glassfish.transaction.TransactionManagerImplCommon.commit(TransactionManagerImplCommon.java:535)
at org.glassfish.transaction.TransactionManagerImplCommon.commit(TransactionManagerImplCommon.java:529)
...
Caused by: javax.transaction.xa.XAException : Failed state during prepare of WS-AT XAResource:WSATXAResource: xidBEA1-xxxx status:Aborted epr:<?xml version="1.0" encoding="UTF-8"?>
<ns0:EndpointReference xmlns:ns0="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ns0:Address>http://1.1.1.1:1111/wls-wsat/ParticipantPortType</ns0:Address><ns0:ReferenceParameters><wls-wsat:txId xmlns:wls-wsat="http://weblogic.wsee.wstx.wsat/ws/2008/10/wsat">FF1D-xxxx</wls-wsat:txId><wls-wsat:routing xmlns:wls-wsat="http://weblogic.wsee.wstx.wsat/ws/2008/10/wsat">WLS_xxxx</wls-wsat:routing></ns0:ReferenceParameters></ns0:EndpointReference> isRemovedFromMap:false
at org.glassfish.transaction.TransactionManagerImplCommon.commit(TransactionManagerImplCommon.java:535)
at org.glassfish.transaction.TransactionManagerImplCommon.commit(TransactionManagerImplCommon.java:529)
...


This was strange because all of the code was dot-to-dot as per the documentation and the data source connection pool was set up with the oracle.jdbc.xa.client.OracleXADataSource driver. It should have worked.
wsaterr_1.png




I figured that there had to be some problem with the data source still, so I went looking around. And I didn't have to go far because the Transaction configuration tab revealed the problem.
wsaterr_2.png


The "Use XA Data Source Interface" option was not enabled! The fix was of course to enable this option and then restart WebLogic. Once that was done all WS-AT calls worked perfectly.

So the exception message may not have been very intuitive but the fix certainly was. It pays to inspect configuration on the managed server side when using new features that depend on the environment being configured correctly first. Lesson learned - don't assume that all configuration is going to be as expected!

-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.