Note that there are some explanatory texts on larger screens.

plurals
  1. POContainer Manager Transactions and JackRabbit
    text
    copied!<p>I currently have Jackrabbit 2.6.4 deployed in Glassfish 4 using the JCA rar.</p> <p>I am using MySql and have configured a datasource in Glassfish to access the database. I use the same datasource in the Jackrabbit repository.xml when configuring the RepositoryManager.</p> <p>If I inject a repository via the @Resource annotation into a container managed bean that does not automatically start a transaction everything works as expected.</p> <p>If I inject a repository via the @Resource annotation into a EJB (which results in a container managed transaction) I get the following stack trace when I attempt to use the repository:</p> <blockquote> <p>javax.resource.spi.LocalTransactionException: Can't call commit when autocommit=true at com.sun.gjc.spi.LocalTransactionImpl.commit(LocalTransactionImpl.java:112) at com.sun.enterprise.resource.ConnectorXAResource.commit(ConnectorXAResource.java:124) ... Caused by: java.sql.SQLException: Can't call commit when autocommit=true at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924) at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1724) at com.sun.gjc.spi.LocalTransactionImpl.commit(LocalTransactionImpl.java:106) ... 72 more ]] [2013-10-28T14:49:29.646-0700] [glassfish 4.0] [WARNING] [jts.unexpected_error_occurred_twopc_commit] [javax.enterprise.system.core.transaction.com.sun.jts.jtsxa] [tid: _ThreadID=33 _ThreadName=http-listener-1(3)] [timeMillis: 1382996969646] [levelValue: 900] [[ JTS5067: Unexpected error occurred in commit javax.transaction.xa.XAException: javax.resource.spi.LocalTransactionException: Can't call commit when autocommit=true at com.sun.enterprise.resource.ConnectorXAResource.handleResourceException(ConnectorXAResource.java:115) at com.sun.enterprise.resource.ConnectorXAResource.commit(ConnectorXAResource.java:126) ... ]]</p> </blockquote> <p>Looking at the Jackrabbit documentation is states:</p> <blockquote> <p>If you use a database persistence manager, the configured database connection must not be under the control of an external transaction manager. Jackrabbit implements distributed XA transaction support on a higher level, and expects to be in full control of the underlying database connection.</p> </blockquote> <p>Given this how do/can I configure Jackrabbit and Glassfish to allow both container managed transactions and Jackrabbit managed transactions to participate together in the same global transaction?</p> <p>I have tried setting both the Jackrabbit JCA adapter and the Datasource Connection Pool to use XA Transactions. I have also set the Jackrabbit JCA property bindSessionToTransaction to true. Neither of these worked. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload