jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1013) Connection.setAutoCommit(...) fails if connection is managed for JNDIDatabasePersistenceManager
Date Fri, 06 Jul 2007 13:15:04 GMT

    [ https://issues.apache.org/jira/browse/JCR-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510678
] 

Stefan Guggisberg commented on JCR-1013:
----------------------------------------

the patch for DatabaseFileSystem actually changes the behavior, i guess that's a mistake.
it should probably read

--- src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java	(revision 553455)
+++ src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java	(working copy)
@@ -954,7 +945,9 @@
      */
     protected void initConnection() throws Exception {
         con = getConnection();
-        con.setAutoCommit(true);
+        if (!con.getAutoCommit()) {
+            con.setAutoCommit(true);
+        }


> Connection.setAutoCommit(...) fails if connection is managed for JNDIDatabasePersistenceManager
> -----------------------------------------------------------------------------------------------
>
>                 Key: JCR-1013
>                 URL: https://issues.apache.org/jira/browse/JCR-1013
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: JBoss, Jackrabbit 1.3,  JNDIDatabasePersistenceManager
>            Reporter: Marcel  May
>         Attachments: patch.txt
>
>
> Invoking setAutoCommit() on a db connection fails if the connection is managed.
> I propose as a workaround to check if the auto commit must be set previous to setting
it (a trivial patch will be provided).
> This can happen eg. if you use JNDI (eg JNDIDatabasePersistenceManager) to fetch the
connection on JBoss, and the persistent manager tries to reconnect (see stack trace below).
> 05 Jul 09:54:24 ERROR sePersistenceManager| failed to re-establish connection
> java.sql.SQLException: You cannot set autocommit during a managed transaction!
>         at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:482)
>         at org.jboss.resource.adapter.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:322)
>         at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.initConnection(DatabasePersistenceManager.java:731)
>         at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.reestablishConnection(DatabasePersistenceManager.java:806)
>         at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.executeStmt(DatabasePersistenceManager.java:852)
>         at org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.exists(DatabasePersistenceManager.java:647)
>         at org.apache.jackrabbit.core.state.SharedItemStateManager.hasNonVirtualItemState(SharedItemStateManager.java:1102)
>         at org.apache.jackrabbit.core.state.SharedItemStateManager.hasItemState(SharedItemStateManager.java:289)
>         at org.apache.jackrabbit.core.state.LocalItemStateManager.hasItemState(LocalItemStateManager.java:180)
>         at org.apache.jackrabbit.core.state.XAItemStateManager.hasItemState(XAItemStateManager.java:252)
>         at org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState(SessionItemStateManager.java:174)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message