Problem with XA Transactions in JBoss when use multiple datasources for related tables
posted 4 years ago
Help me please with XA transactions.
I can't create two records in two related tables of differents schemas from DB2 AS400 database.
I'm developing an application with EJB 3.1, JPA 2.0, Hibernate 3.6.5, JBoss AS 6.0, DB2 AS400. All it's configured with XA transactions support.
I have two tables:KSSEGTUSER in DSMXMBASE schema, SSPCOTFUNCIONARIO in DSMXCORP schema.
KSSEGTUSER is mapped to UserDTO JPA 2.0 entity bean in the prjFrameworkV2 project.
SSPCOTFUNCIONARIO is mapped to FuncionarioDTO JPA 2.0 entity bean in the prjCorporativoV2 project.
For create or update the UserDTO, I have a Singleton Session bean named UsuarioServiceImpl, it has a UsuarioServiceLocal by Local Session Bean interface and it has a UsuarioServiceRemote by Remote Session Bean interface.
For create or update the FuncionarioDTO, I have a Singleton Session bean named FuncionarioServiceImpl, it has a FuncionarioServiceLocal by
Local Session Bean interface and
it has a FuncionarioServiceRemote by Remote Session Bean interface.
In the create method of funcionario of FuncionarioServiceImpl I'm calling to create method of usuario of UsuarioServiceImpl via EJB Local injection.
The problem is that I don´t insert the user and employee in same transaction, the application throw an exception when inserting the employe, the stack trace is:
But when I deploy the same application in GlassFish 3.1, the application works fine. The funcionario and usuario was cretead sucessfully.