XTS + JTA + MyBatis-Spring
anderruiz Apr 3, 2014 12:36 PM(This message is not answered it was my fault, and I don't know were to change it..)
I'm trying to implement atomic transactions between different WS calls in a WAR file that uses MyBatis-Spring. I'm trying to put all the pieces together but I still don't understand what am I missing.
What I already have
- XTS running
- A client that creates a UserTransaction, that transaction is available in the WS code
(http-/0.0.0.0:8080-4) UserManagement transaction id =AtomicTransactionIdentifier: urn:0:ffff0a849f13:4142a6d1:533d7738:1c
- I included context handlers for parsing the new Headers and for trying to connect the transaction to a JTA transaction in JBoss
<?xml version="1.0" encoding="UTF-8"?> <!-- --> <handler-chains xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee"> <handler-chain> <protocol-bindings>##SOAP11_HTTP</protocol-bindings> <!-- JSR 181 does not seem to directly define how the handler chain is constructed from this xml, although JSR 109 6.2.2.3 seems to indicate the parser is required to maintain the declared ordering. JSR 224 9.3.2 says the constructed chain is then invoked in reverse order for inbound requests. Since we need the HeaderContextProcessor to be invoked before the InboundBridgeHandler, we therefore list the InboundBridgeHandler first --> <handler> <handler-name>TransactionBridgeHandler</handler-name> <handler-class>org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler</handler-class> </handler> <handler> <handler-name>ContextHandler</handler-name> <handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class> </handler> </handler-chain> </handler-chains>
With the previous configuration, according to my understanding I will have a CMT using JTA right?
- In MyBatis-Spring I tried to configure it to use JTA/CMT transactions also. This is my applicationContext.xml
<bean id="telventDB" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:driverClassName="${jdbc.driverClassName}" p:password="${jdbc.password}" p:url="${jdbc.url}" p:username="${jdbc.username}" /> <bean id="wsSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="telventDB" /> <property name="typeHandlersPackage" value="com.telvent.tolling.typehandlers" /> </bean> <!-- enable component scanning --> <context:component-scan base-package="com.telvent.tolling" /> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.telvent.tolling.tps.mapper;com.telvent.tolling.utility.mapper;com.telvent.tolling.core.wfe.mapper;com.telvent.tolling.vps.mapper;com.telvent.tolling.csc.mapper;com.telvent.tolling.fareschedule.mapper;com.telvent.tolling.tagplate.mapper;com.telvent.tolling.vendor.mapper;com.telvent.tolling.feemanagement.mapper;com.telvent.tolling.shiftmanagement.mapper;com.telvent.tolling.systemparameter.mapper;com.telvent.tolling.core.usermanagement.mapper" /> <property name="sqlSessionFactoryBeanName" value="wsSqlSessionFactory" /> </bean> <!-- enable autowire --> <context:annotation-config /> <tx:jta-transaction-manager />
I'm testing one insert in the database and one error (without an exception) that the client detects and executes a rollback. Attached the output that I get
Am I missing something obvious?
-
jboss.log.zip 6.0 KB