user2988422
user2988422

Reputation: 27

Error committing transaction using JDBC - Operation Connection.commit is not allowed during a global transaction

Am getting the following error when am trying to commit transaction using jdbc from a local ejb connection.commit(); Oracle database

java.sql.SQLException: DSRA9350E: Operation Connection.commit is not allowed during a global transaction. [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.commit(WSJdbcConnection.java:941) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.bmo.olbb.mostvisitedcount.ejb.MergeAuditRecordsBean.startOperation(MergeAuditRecordsBean.java:89) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.bmo.olbb.mostvisitedcount.ejb.MergeAuditRecordsBean.updatePageCountValues(MergeAuditRecordsBean.java:21) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.bmo.olbb.mostvisitedcount.ejb.EJSLocal0SLMergeAuditRecordsBean_9da6c3b0.updatePageCountValues(EJSLocal0SLMergeAuditRecordsBean_9da6c3b0.java) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.bmo.ctp.test.testEJBservlet.doGet(testEJBservlet.java:51) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1103) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:486) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:644) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873) [17/11/13 15:33:00:621 EST] 00000029 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

Upvotes: 1

Views: 18188

Answers (4)

JitenS
JitenS

Reputation: 51

  1. Navigate to Resources > JDBC > JDBC providers > JDBC_provider > Data sources > data_source > WebSphere Application Server data source properties

  2. Check Non-transactional data source property.

Upvotes: 0

Ricardo Sarto
Ricardo Sarto

Reputation: 1

One time I had de same problem. At that time I was using EJB 1.0 and the problem was happening because I did not map the EJB method in Container Transaction Section inside the ejb-jar.xml

Upvotes: 0

rushabhkumar khandare
rushabhkumar khandare

Reputation: 53

In XA-Datasources->WebSphere Application Server data source properties->WebSphere Application Server data source properties->click Non-transactional data source as True.

Upvotes: 4

Mark Rotteveel
Mark Rotteveel

Reputation: 109015

Your application is probably using a Container-Managed Transaction or another kind of managed connection. When using managed transactions you are not allowed to commit() yourself, as that is handled by the application container (maybe even using a distributed transaction if you are using multiple datasources).

See Container-Managed Transactions in the JavaEE 7 tutorial:

Enterprise beans that use container-managed transaction demarcation must not use any transaction-management methods that interfere with the container's transaction demarcation boundaries. Examples of such methods are the commit, setAutoCommit, and rollback methods of java.sql.Connection or the commit and rollback methods of javax.jms.Session. If you require control over the transaction demarcation, you must use application-managed transaction demarcation.

A commit() is done automatically if the method (or chain of methods) completes without an Exception (unless an explicit rollback is requested on the context).

Upvotes: 3

Related Questions