sindhu
sindhu

Reputation: 61

EJB transaction rolled back exception

I am using ejb-2 I get the following exception. Can someone tell me what does it mean, and what can be the possible solution for this:

Error (fatal): EJB Exception: ; nested exception is:
javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is:
weblogic.transaction.internal.AppSetRollbackOnlyException

Upvotes: 5

Views: 22444

Answers (3)

A_proud_indian
A_proud_indian

Reputation: 23

I was also facing the same problem. I just want to share my experience with you all. It is right that the actual exception is not mentioned in this aforesaid exception. To reveal that exception I have used wlspy.jar tool. Using this tool I got the inner sql activity in configured log file. Due to which I got the hidded sql constraint exception. Steps to Configure: 1) Add wlspy.jar in your weblogic server classpath. 2) Add configurations related to wlspy in database source.

For example:

jdbc:bea:DB2://db2host:50000;spyAttributes=(log=(file)/opt/bea/logs/mySpy.log;timestamp=yes)

After that restart your weblogic server and do the activity. You will get database related logs in mySoy.log file. In my case I got the actual constraint exception.

Go through this link: http://docs.oracle.com/cd/E21764_01/web.1111/e13753/spy.htm#JDBCD469

Upvotes: 2

ayortanli
ayortanli

Reputation: 121

You should flush the changes to the database then ejb will probably show you the real exception. If not works, put flush to the points that seem to be possible cause of the exception. By this way you can guaranteed to find real position and also real cause of the exception.

Upvotes: 1

Donato Szilagyi
Donato Szilagyi

Reputation: 4369

Try to find out what the real exception is. To do this, transform your ejb to use bean managed transaction. Then you can commit manually and can catch the exception the commit throws.

WebLogic likes to hide exceptions thrown in commit phase when using container managed transaction. Usually the reason is a database constraint what is not known by the EJB tier, eg. a function-based unique index in Oracle.

Upvotes: 2

Related Questions