You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Malzer Ferdinand OSP sIT <Fe...@s-itsolutions.at> on 2013/03/11 15:33:58 UTC

using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        Transaction tx = null;
        try {
            session = login(...);

            tx = new Transaction();
            tx.begin();

            //delete resources persisted in another TX datasource
            cleanOtherDBResources();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.softRollback();}
        } finally {
            if (session != null) { session.logout();}
        }


when we use a  non XA-datasource for the JackRabbit PersistenceManager we get the following exception:

Caused by: java.sql.SQLException: Connection has already been created in this tx context for pool named cmspool. Illegal attempt to create connection from another pool: jackrabbitpool
        at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:608)
        at weblogic.jdbc.jts.Driver.connect(Driver.java:127)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.getConnection(ConnectionHelper.java:436)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.startBatch(ConnectionHelper.java:239)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.startBatch(DatabaseJournal.java:506)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.doLock(DatabaseJournal.java:474)


when we use a XA-datasource for the JackRabbit PersistenceManager we get the following exception:

Caused by: java.sql.SQLException: Cannot set auto commit to "true" when in distributed transaction.
        at weblogic.jdbc.wrapper.JTSConnection.setAutoCommit(JTSConnection.java:593)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.getConnection(ConnectionHelper.java:439)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.startBatch(ConnectionHelper.java:239)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.startBatch(DatabaseJournal.java:506)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.doLock(DatabaseJournal.java:474)

Does somebody know how to use javax.transaction.UserTransaction in JackRabbit and how the datasource has to be configured?
Thx in advance!

ferry malzer

AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by Malzer Ferdinand OSP sIT <Fe...@s-itsolutions.at>.
hello,
thx for your information.

now i have configured the used woblogic-datasource to 'don't support global transactions' and now it works fine.
:-) ferry malzer 

-----Ursprüngliche Nachricht-----
Von: KÖLL Claus [mailto:C.KOELL@TIROL.GV.AT] 
Gesendet: Montag, 25. März 2013 08:01
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3 [heur]

Hi Ferdinant,

Jackrabbit itself is the XA Resource so therefore you must not use a datasource witch is managed by the container.
Can you attach your config file ?

greets
claus

-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT [mailto:Ferdinand.Malzer@s-itsolutions.at] 
Gesendet: Montag, 11. März 2013 15:34
An: users@jackrabbit.apache.org
Betreff: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        Transaction tx = null;
        try {
            session = login(...);

            tx = new Transaction();
            tx.begin();

            //delete resources persisted in another TX datasource
            cleanOtherDBResources();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.softRollback();}
        } finally {
            if (session != null) { session.logout();}
        }


when we use a  non XA-datasource for the JackRabbit PersistenceManager we get the following exception:

Caused by: java.sql.SQLException: Connection has already been created in this tx context for pool named cmspool. Illegal attempt to create connection from another pool: jackrabbitpool
        at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:608)
        at weblogic.jdbc.jts.Driver.connect(Driver.java:127)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.getConnection(ConnectionHelper.java:436)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.startBatch(ConnectionHelper.java:239)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.startBatch(DatabaseJournal.java:506)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.doLock(DatabaseJournal.java:474)


when we use a XA-datasource for the JackRabbit PersistenceManager we get the following exception:

Caused by: java.sql.SQLException: Cannot set auto commit to "true" when in distributed transaction.
        at weblogic.jdbc.wrapper.JTSConnection.setAutoCommit(JTSConnection.java:593)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.getConnection(ConnectionHelper.java:439)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.startBatch(ConnectionHelper.java:239)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.startBatch(DatabaseJournal.java:506)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.doLock(DatabaseJournal.java:474)

Does somebody know how to use javax.transaction.UserTransaction in JackRabbit and how the datasource has to be configured?
Thx in advance!

ferry malzer

AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by KÖLL Claus <C....@TIROL.GV.AT>.
Hi Ferdinant,

Jackrabbit itself is the XA Resource so therefore you must not use a datasource witch is managed by the container.
Can you attach your config file ?

greets
claus

-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT [mailto:Ferdinand.Malzer@s-itsolutions.at] 
Gesendet: Montag, 11. März 2013 15:34
An: users@jackrabbit.apache.org
Betreff: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        Transaction tx = null;
        try {
            session = login(...);

            tx = new Transaction();
            tx.begin();

            //delete resources persisted in another TX datasource
            cleanOtherDBResources();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.softRollback();}
        } finally {
            if (session != null) { session.logout();}
        }


when we use a  non XA-datasource for the JackRabbit PersistenceManager we get the following exception:

Caused by: java.sql.SQLException: Connection has already been created in this tx context for pool named cmspool. Illegal attempt to create connection from another pool: jackrabbitpool
        at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:608)
        at weblogic.jdbc.jts.Driver.connect(Driver.java:127)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.getConnection(ConnectionHelper.java:436)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.startBatch(ConnectionHelper.java:239)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.startBatch(DatabaseJournal.java:506)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.doLock(DatabaseJournal.java:474)


when we use a XA-datasource for the JackRabbit PersistenceManager we get the following exception:

Caused by: java.sql.SQLException: Cannot set auto commit to "true" when in distributed transaction.
        at weblogic.jdbc.wrapper.JTSConnection.setAutoCommit(JTSConnection.java:593)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.getConnection(ConnectionHelper.java:439)
        at org.apache.jackrabbit.core.util.db.ConnectionHelper.startBatch(ConnectionHelper.java:239)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.startBatch(DatabaseJournal.java:506)
        at org.apache.jackrabbit.core.journal.DatabaseJournal.doLock(DatabaseJournal.java:474)

Does somebody know how to use javax.transaction.UserTransaction in JackRabbit and how the datasource has to be configured?
Thx in advance!

ferry malzer

AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by Malzer Ferdinand OSP sIT <Fe...@s-itsolutions.at>.
hello,
thanks for the information.
:-) ferry malzer


-----Ursprüngliche Nachricht-----
Von: KÖLL Claus [mailto:C.KOELL@TIROL.GV.AT] 
Gesendet: Mittwoch, 03. Juli 2013 08:45
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hi Ferdinand,

Of course we use jackraabit a long time with transactions ...

Here is a doku how to configure jackrabbit to use transactions...
http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

greets
claus


-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT [mailto:Ferdinand.Malzer@s-itsolutions.at] 
Gesendet: Mittwoch, 3. Juli 2013 08:31
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello again,

Does anybody know documentation how to use transactions with JackRabbit 2.4.3 beyond the stuff of chapter 21 of the JCR 2.0 spec?

ferry malzer


-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Freitag, 21. Juni 2013 14:28
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
Is there anybody who successfully uses transactions with JackRabbit?

ferry malzer

-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Mittwoch, 19. Juni 2013 16:31
An: users@jackrabbit.apache.org
Betreff: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        UserTransaction tx = null;
        try {
            session = login(...);

            tx = new UserTransactionImpl();
            tx.begin();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            //delete resources persisted in another XA datasource
            cleanOtherDBResources();

	doSomeOtherCode();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.rollback();}
        } finally {
            if (session != null) { session.logout();}
        }


When in doSomeOtherCode() an exception is thrown, than the steps done in cleanOtherDBResources() are roll-back but JackRabbit's node.remove() is not roll-back.

Perhaps I miss some configuration issues to use JackRabbit in a UserTransaction correctly.

Does somebody know how to use javax.transaction.UserTransaction in a JackRabbit environment?
Thx in advance!

ferry malzer

AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by KÖLL Claus <C....@TIROL.GV.AT>.
Hi Ferdinand,

Of course we use jackraabit a long time with transactions ...

Here is a doku how to configure jackrabbit to use transactions...
http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

greets
claus


-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT [mailto:Ferdinand.Malzer@s-itsolutions.at] 
Gesendet: Mittwoch, 3. Juli 2013 08:31
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello again,

Does anybody know documentation how to use transactions with JackRabbit 2.4.3 beyond the stuff of chapter 21 of the JCR 2.0 spec?

ferry malzer


-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Freitag, 21. Juni 2013 14:28
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
Is there anybody who successfully uses transactions with JackRabbit?

ferry malzer

-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Mittwoch, 19. Juni 2013 16:31
An: users@jackrabbit.apache.org
Betreff: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        UserTransaction tx = null;
        try {
            session = login(...);

            tx = new UserTransactionImpl();
            tx.begin();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            //delete resources persisted in another XA datasource
            cleanOtherDBResources();

	doSomeOtherCode();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.rollback();}
        } finally {
            if (session != null) { session.logout();}
        }


When in doSomeOtherCode() an exception is thrown, than the steps done in cleanOtherDBResources() are roll-back but JackRabbit's node.remove() is not roll-back.

Perhaps I miss some configuration issues to use JackRabbit in a UserTransaction correctly.

Does somebody know how to use javax.transaction.UserTransaction in a JackRabbit environment?
Thx in advance!

ferry malzer

AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by Malzer Ferdinand OSP sIT <Fe...@s-itsolutions.at>.
Hello again,

Does anybody know documentation how to use transactions with JackRabbit 2.4.3 beyond the stuff of chapter 21 of the JCR 2.0 spec?

ferry malzer


-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Freitag, 21. Juni 2013 14:28
An: users@jackrabbit.apache.org
Betreff: AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
Is there anybody who successfully uses transactions with JackRabbit?

ferry malzer

-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Mittwoch, 19. Juni 2013 16:31
An: users@jackrabbit.apache.org
Betreff: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        UserTransaction tx = null;
        try {
            session = login(...);

            tx = new UserTransactionImpl();
            tx.begin();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            //delete resources persisted in another XA datasource
            cleanOtherDBResources();

	doSomeOtherCode();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.rollback();}
        } finally {
            if (session != null) { session.logout();}
        }


When in doSomeOtherCode() an exception is thrown, than the steps done in cleanOtherDBResources() are roll-back but JackRabbit's node.remove() is not roll-back.

Perhaps I miss some configuration issues to use JackRabbit in a UserTransaction correctly.

Does somebody know how to use javax.transaction.UserTransaction in a JackRabbit environment?
Thx in advance!

ferry malzer

AW: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by Malzer Ferdinand OSP sIT <Fe...@s-itsolutions.at>.
Hello,
Is there anybody who successfully uses transactions with JackRabbit?

ferry malzer

-----Ursprüngliche Nachricht-----
Von: Malzer Ferdinand OSP sIT 
Gesendet: Mittwoch, 19. Juni 2013 16:31
An: users@jackrabbit.apache.org
Betreff: using javax.transaction.UserTransaction with JackRabbit 2.4.3

Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        UserTransaction tx = null;
        try {
            session = login(...);

            tx = new UserTransactionImpl();
            tx.begin();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            //delete resources persisted in another XA datasource
            cleanOtherDBResources();

	doSomeOtherCode();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.rollback();}
        } finally {
            if (session != null) { session.logout();}
        }


When in doSomeOtherCode() an exception is thrown, than the steps done in cleanOtherDBResources() are roll-back but JackRabbit's node.remove() is not roll-back.

Perhaps I miss some configuration issues to use JackRabbit in a UserTransaction correctly.

Does somebody know how to use javax.transaction.UserTransaction in a JackRabbit environment?
Thx in advance!

ferry malzer

using javax.transaction.UserTransaction with JackRabbit 2.4.3

Posted by Malzer Ferdinand OSP sIT <Fe...@s-itsolutions.at>.
Hello,
In JackRabbit the query of Repository.OPTION_TRANSACTIONS_SUPPORTED return true.
Therefore we want to use javax.transaction.UserTransaction with JackRabbit.

What we want to do is shown in the following simplified pseude-code:


        Session session = null;
        UserTransaction tx = null;
        try {
            session = login(...);

            tx = new UserTransactionImpl();
            tx.begin();

            //delete a node persisted in JackRabbit
            Node node = session.getNode(path);
            node.remove();
            session.save();

            //delete resources persisted in another XA datasource
            cleanOtherDBResources();

	doSomeOtherCode();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) { tx.rollback();}
        } finally {
            if (session != null) { session.logout();}
        }


When in doSomeOtherCode() an exception is thrown, than the steps done in cleanOtherDBResources() are roll-back but JackRabbit's node.remove() is not roll-back.

Perhaps I miss some configuration issues to use JackRabbit in a UserTransaction correctly.

Does somebody know how to use javax.transaction.UserTransaction in a JackRabbit environment?
Thx in advance!

ferry malzer