cancel
Showing results for 
Search instead for 
Did you mean: 

BaseResourceException- 2 phase committ Problem.

Former Member
0 Kudos

Hi,

Scenario: I have a method which calls an external service (BAPI) and another method which calls a database table.

Problem: I get the below Exception.

ResourceException occurred in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: The resource "xxxDB" does not support two-phase commit and cannot be enlisted in the current transaction, because another non supporting two-phase commit resource is already enlisted for component "ejbContexts/xxx.com/dcyyyear/xxx.

Both the methods return output individually but when called inside this outer method, I get above Exception.

Can anyone help me out with this?

Regards,

Gaurav.

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Gaurav,

Well, the exception message more or less says it all. You have a connection to a SAP backend already enlisted in the JTA transaction, and you are trying to get a connection to a DB which also comes from a non-XA datasource. You cannot have more than one non-XA-enabled connection enlisted in the same transaction. Either you have to make one of them XA, or demarcate transactions in a more fine-grained manner and use these two connections in different transactions, or make one of them non-transactional.

For more information, please refer to [this|http://help.sap.com/saphelp_nwce10/helpdata/en/ce/32dfe352a04b5fb8a89b4f245fd93b/frameset.htm] help page.

HTH!

\-- Vladimir

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank You all for replying. My problem has been solved.I made use of 2 separate application Services-1 for accessing the backend and another for accessing the portal database.

Regards,

Gaurav.

Former Member
0 Kudos

Hi

This error is common when you call a data base transaction inside a managed class on JEE as the managed class is by default under a transaction (using JTS).

When you make a DB call from a managed class you are already surrounded by a transaction so disable the auto-commit inside your DB call. The managed class will handle the distributed transaction.

Thank you.

Regards

LNV

Former Member
0 Kudos

You may also try to put an annotation on your managed class to controll transational behavior.

When I get this exception, it was mostly in sceanrios where I made a DB call and a WebService call from within a managed class (maybe indirectly...). So I put the following annotation on the managed class:

@TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)

Maybe this helps...

Frank