EJB transaction rolled back exception

18,242

Solution 1

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.

Solution 2

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

Solution 3

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.

Share:
18,242

Related videos on Youtube

sindhu
Author by

sindhu

Updated on June 04, 2022

Comments

  • sindhu
    sindhu almost 2 years

    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

  • feder
    feder over 9 years
    Yes, flush is how you can enforce it to bring the orgin exception up to the surface. I confirm this for container-managed Entity Bean with WebLogic 12.1.1.