DATASOURCE resource rollback in LocalTransactionContainment cleanup

Im runs on WebSphere Application Server 7, JDK 1.6, and Oracle 11g.

I always get this error when using ejb.

[7/1/10 17: 12: 28: 770 BOT] 00000013 LocalTranCoor W WLTC0033W: The jdbc / oraDS11 resource is rolled back during the LocalTransactionContainment cleanup process. [7/1/10 17: 12: 28: 773 BOT] 00000013 LocalTranCoor W WLTC0032W: One or more local transactional resources are rolled back during LocalTransactionContainment cleanup.

This is how I get the connection from the data source in WAS.

javax.sql.DataSource ds = (javax.sql.DataSource) naming.lookup("DataSource"); conn= ds.getConnection(); 

Any help would be appreciated ...

+4
source share
2 answers

From the error message, you are doing some work inside a local transaction and not doing it . Unoccupied work gets rolled back by the container at the end of the method (by default).

This answer The rollback of data in WAS6.0 sums it all up pretty well, and since it makes no sense to rephrase it, I will quote it below.

A LocalTransactionContainment is what you get in the absence of a global (XA). The message indicates that you performed some local transaction as part of this scope (method or activity session), and then did not commit . default behavior (unauthorized action is controlled) - rollback of any unreasonable work at the end of the volume. You have several options:

  • Explicitly commit a local transaction

     connection.commit(); // after the work has been performed 
  • Change the data source to use auto-commit

     connection.setAutoCommit(true); // 

    before the connection is used

  • Put work in a global transaction

     Context ic = new InitialContext(); UserTransaction ut = (UserTransaction) ic.lookup("java:comp/UserTransaction"); ut.begin(); // use connection here ut.commit(); 
  • Change the unresolved action to complete. Select the Servlets tab of the deployment descriptor editor and then select the servlet in the question. In the "WebSphere Extensions" section and then "Local Transaction" set "Unauthorized Actions" to "commit" in the drop-down menu.

I suggest doing the work explicitly (and read the whole answer).

+5
source

This exception occurs when a table is locked, so you locked your table in the database to release this lock and make all the changes you made.

+1
source

Source: https://habr.com/ru/post/1314513/


All Articles