[
https://issues.apache.org/jira/browse/JCR-769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480380
]
Claus Köll commented on JCR-769:
--------------------------------
I have changed the code in the XASessionImpl to store the TransactionContext
with the GlobalTransactionId as Key in the txGlobal Map
instead the whole Xid Object to get only one TransactionContext Object during
the whole XATransaction
This works fine for me and i think this is the right way.
I have traced the entire XA Transaction.
As you will see the problem with the lock in the WorkspaceInfo Object still
occurs without my Patch !
The Log:
=2007-03-13 13:43:52,043 INFO - XASessionImpl start for [EMAIL PROTECTED] with
Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004842354235)}
=2007-03-13 13:43:52,059 INFO - XASessionImpl start flag is TMNOFLAGS
=2007-03-13 13:43:52,090 INFO - XASessionImpl found Transaction: null
=2007-03-13 13:43:52,090 INFO - XASessionImpl associate for [EMAIL PROTECTED]
with Context: [EMAIL PROTECTED]
=2007-03-13 13:43:52,106 INFO - XASessionImpl start for [EMAIL PROTECTED] with
Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004877407740)}
=2007-03-13 13:43:52,106 INFO - XASessionImpl start flag is TMNOFLAGS
=2007-03-13 13:43:52,106 INFO - XASessionImpl found Transaction: [EMAIL
PROTECTED]
=2007-03-13 13:43:52,106 INFO - XASessionImpl associate for [EMAIL PROTECTED]
with Context: [EMAIL PROTECTED]
=2007-03-13 13:43:52,621 INFO -
at.gv.tirol.common.jcr.security.AccessManager.isGranted()[MESSAGE] No
AccessNodeList check for Node:* {}2d3d89030a0c889a36853685d9d417b1.pdf
{http://www.jcp.org/jcr/1.0}content
=2007-03-13 13:43:52,621 INFO -
at.gv.tirol.common.jcr.security.AccessManager.isGranted()[MESSAGE] No
AccessNodeList check for Node:* {}2d3d89030a0c889a36853685d9d417b1.pdf
=2007-03-13 13:43:52,621 INFO -
at.gv.tirol.common.jcr.security.AccessManager.isGranted()[MESSAGE] No
AccessNodeList check for Node:* {}2d3d89030a0c889a36853685d9d417b1.pdf
{http://www.jcp.org/jcr/1.0}content
=2007-03-13 13:43:52,653 INFO -
at.gv.tirol.common.jcr.security.AccessManager.isGranted()[MESSAGE] No
AccessNodeList check for Node:* {}2d3d89030a0c889a36853685d9d417b1.pdf
=2007-03-13 13:43:52,653 INFO -
at.gv.tirol.common.jcr.security.AccessManager.isGranted()[MESSAGE] Access to
Root Node
=2007-03-13 13:43:52,684 INFO - XASessionImpl end for [EMAIL PROTECTED] with
Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004877407740)}
=2007-03-13 13:43:52,684 INFO - XASessionImpl associate for [EMAIL PROTECTED]
with Context: null
=2007-03-13 13:43:52,684 INFO - XASessionImpl end for [EMAIL PROTECTED] with
Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004842354235)}
=2007-03-13 13:43:52,684 INFO - XASessionImpl associate for [EMAIL PROTECTED]
with Context: null
=2007-03-13 13:43:52,684 INFO - XASessionImpl prepare for [EMAIL PROTECTED]
with Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004877407740)}
=2007-03-13 13:43:52,684 INFO - XASessionImpl TransactionContext.prepare start
=2007-03-13 13:43:52,684 INFO - TransactionContext prepare beforeOperation()
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,684 INFO - TransactionContext prepare beforeOperation end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,684 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,684 INFO - Resource is [EMAIL PROTECTED]
XAWorkspace prepare in XAResourceBegin lockAcquire start
=2007-03-13 13:43:52,684 INFO - WorkspaceInfo lockAcquire() lock is already
false
XAWorkspace prepare in XAResourceBegin lockAcquire end
=2007-03-13 13:43:52,684 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,684 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,684 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare afterOperation
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare afterOperation end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare Method end [EMAIL
PROTECTED]
=2007-03-13 13:43:52,715 INFO - XASessionImpl TransactionContext.prepare end
=2007-03-13 13:43:52,715 INFO - XASessionImpl return 0
=2007-03-13 13:43:52,715 INFO - XASessionImpl prepare for [EMAIL PROTECTED]
with Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004842354235)}
=2007-03-13 13:43:52,715 INFO - XASessionImpl TransactionContext.prepare start
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare beforeOperation()
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare beforeOperation end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
*** A Lock will be aquired but if we do not check if a lock is already on it a
Deadlock will occur !
XAWorkspace prepare in XAResourceBegin lockAcquire start
=2007-03-13 13:43:52,715 INFO - WorkspaceInfo lockAcquire() lock is already
true
XAWorkspace prepare in XAResourceBegin lockAcquire end
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - Resource is [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare prepareResource end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare afterOperation
start on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare afterOperation end
on [EMAIL PROTECTED]
=2007-03-13 13:43:52,715 INFO - TransactionContext prepare Method end [EMAIL
PROTECTED]
=2007-03-13 13:43:52,715 INFO - XASessionImpl TransactionContext.prepare end
=2007-03-13 13:43:52,715 INFO - XASessionImpl return 0
=2007-03-13 13:43:52,731 INFO - XASessionImpl commit for [EMAIL PROTECTED]
with Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004842354235)}
=2007-03-13 13:43:52,731 INFO - XASessionImpl commit for [EMAIL PROTECTED]
with Xid: {XID: formatId(57415344), gtrid_length(39), bqual_length(28),
data(0000000000000006000000488d8c7348c471a220c9a781d64d29d7e7edb72842736572766572318d8c7348c471a220c9a781d64d29d7e7edb728420000004877407740)}
The next Problem is now that the commit Method from the first Session will
delete the TransactionContext from the Cache and this is very bad because the
second Session
will not find the TransactionContext in the Cache in its commit Method, so a
XAException(XAException.XAER_NOTA) will occur.
I hope this stack will help to understand the problem.
> Unable to login with two different Credentials to same workspace in one
> Transaction
> -----------------------------------------------------------------------------------
>
> Key: JCR-769
> URL: https://issues.apache.org/jira/browse/JCR-769
> Project: Jackrabbit
> Issue Type: Bug
> Components: jca
> Affects Versions: 1.2.1
> Environment: Websphere 5.1.1 J2C Adapter
> Reporter: Claus Köll
> Attachments: patch.txt, stacktrace.txt
>
>
> I'm using the Jackrabbit 1.2.1 JCA adapter and trying to access in a
> SessionBean-Method with Container Transaction a Workspace with 2 different
> Credentials.
> The Method takes about 400ms to finish but no commit on TransactionContextr
> occurs (Debugging ..) only the prepare was called 2 times .
> The Container hangs on the PostInvoke Method about 5 seconds and then i get a
> "javax.transaction.xa.XAException"
> with the Warn Message: Transaction rolled back because timeout expired
> The code ..
> Context ctx = new InitialContext();
> Repository repository = (Repository) ctx.lookup("java:comp/env/jackrabbit");
> Credentials credentials = new SimpleCredentials("user1",
> "password1".toCharArray());
> Credentials credentials2 = new SimpleCredentials("user2",
> "password2".toCharArray());
> Session session1 = repository.login(credentials, "default");
> Session session2 = repository.login(credentials2, "default");
> Session1 adds a node to the workspace .. and with the session2 i do nothing
> except the login !
> If i make no second login the Method works fine.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.