Here it is:
This works fine, but if this occursCode:@Controller public class DoTestImpl implements DoTest { private Service service1; //With dataSource1 private Service service2; //With dataSource2 private SomeDao someDao; //With dataSource1 @Transactional @RequestMapping public String doTest(HttpServletRequest request, HttpServletResponse response){ someDao.insert("3"); try { service1.doIt("1"); service2.doIt("2"); } catch (Exception e) {...} someDao.insert("5"); return "whatever"; } ... } public class ServiceImpl implements Service { private SomeDao someDao; @Transactional(propagation=Propagation.REQUIRES_NEW, rollbackFor=Exception.class) public void doIt(String number) throws Exception{ someDao.insert(number); } } ... <tx:jta-transaction-manager/> <!-- <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/> --> <tx:annotation-driven/> <!-- DataSource with PDO Access.--> <bean id="datasource1" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/datasource1"/> </bean> <!-- DataSource with IntegII Access.--> <bean id="datasource2" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/datasource2"/> </bean> <bean name="/test" class="com.ibm.brmt.mes.test.DoTestImpl"> <property name="service1" ref="service1"/> <property name="service2" ref="service2"/> <property name="someDao" ref="someDao1"/> </bean> <bean id="service1" class="com.ibm.brmt.mes.test.ServiceImpl"> <property name="someDao" ref="someDao1"/> </bean> <bean id="service2" class="com.ibm.brmt.mes.test.ServiceImpl"> <property name="someDao" ref="someDao2"/> </bean> <bean id="someDao1" class="com.ibm.brmt.integii.dao.CarrierAssignDaoImpl"> <property name="dataSource" ref="datasource1"/> </bean> <bean id="someDao2" class="com.ibm.brmt.integii.dao.CarrierAssignDaoImpl"> <property name="dataSource" ref="datasource2"/> </bean> ...
I get :Code:public class ServiceImpl implements Service { private SomeDao someDao; @Transactional(propagation=Propagation.REQUIRES_NEW, rollbackFor=Exception.class) public void doIt(String number) throws Exception{ someDao.insert(number); throw new Exception(); } }
Any idea why I get that?Code:... Caused by: com.ibm.ws.Transaction.IllegalResourceIn2PCTransactionException: Illegal attempt to enlist multiple 1PC XAResources at com.ibm.ws.tx.jta.RegisteredResources.enlistResource(RegisteredResources.java:864) at com.ibm.ws.tx.jta.TransactionImpl.enlistResource(TransactionImpl.java:1781) at com.ibm.ws.tx.jta.TranManagerSet.enlistOnePhase(TranManagerSet.java:612) at com.ibm.ejs.j2c.LocalTransactionWrapper.enlist(LocalTransactionWrapper.java:593) ... 60 more
Seems like the rollbacking of the Service Transaction even if declared with propagation=Propagation.REQUIRES_NEW gets tangled with the initial transaction.
I've added the log provided by 'org.springframework.transaction' in a zip file. problem_log.txt.zip
Thanks


Reply With Quote
