[
https://issues.apache.org/jira/browse/JCR-1633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678337#action_12678337
]
Claus Köll commented on JCR-1633:
---------------------------------
As Alexander wrote i give him partly right. I understand the specification in
that way that you can not lock a node till it has pending changes.
In the context of a transaction it is a little bit difference. I see the
Transaction as a atomic operation so you should be able to lock a node after
create and save in one transaction
although the persistence moves to the commit of the transaction.
I will provide a patch that handles this behaviour with some more tescases so
we can see if it works as described in the specification.
> When node is created and locked in same transaction, exception is thrown
> ------------------------------------------------------------------------
>
> Key: JCR-1633
> URL: https://issues.apache.org/jira/browse/JCR-1633
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, locks, transactions
> Affects Versions: core 1.4.3, core 1.4.4
> Environment: Jackrabbit Core 1.4.4, Jencks 2.0, Springmodules 0.8a,
> Jackrabbit JCA 1.4
> Reporter: Roman Puchkovskiy
> Attachments: test-create-and-lock-in-same-tx.zip, XALockTest.java
>
>
> Following code fails when executed inside an XA transaction:
> Node n = session.getRootNode().addNode("n");
> n.addMixin("mix:lockable");
> session.save();
> Lock lock = n.lock(false, false);
> Stacktrace is
> Caused by: javax.transaction.xa.XAException
> at
> org.apache.jackrabbit.core.TransactionContext.prepare(TransactionContext.java:155)
> at
> org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:337)
> at
> org.apache.jackrabbit.jca.TransactionBoundXAResource.commit(TransactionBoundXAResource.java:39)
> at
> org.apache.geronimo.transaction.manager.WrapperNamedXAResource.commit(WrapperNamedXAResource.java:47)
> at
> org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:301)
> ... 32 more
> Caused by: org.apache.jackrabbit.core.TransactionException: Unable to update.
> at
> org.apache.jackrabbit.core.lock.XAEnvironment.prepare(XAEnvironment.java:275)
> at
> org.apache.jackrabbit.core.lock.XALockManager.prepare(XALockManager.java:245)
> at
> org.apache.jackrabbit.core.TransactionContext.prepare(TransactionContext.java:138)
> ... 36 more
> Caused by: javax.jcr.ItemNotFoundException: failed to build path of
> 48fb59d8-ac77-4b9f-8b53-9f2492dca5e5: 48fb59d8-ac77-4b9f-8b53-9f2492dca5e5:
> 48fb59d8-ac77-4b9f-8b53-9f2492dca5e5
> at
> org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManagerImpl.java:407)
> at
> org.apache.jackrabbit.core.CachingHierarchyManager.getPath(CachingHierarchyManager.java:272)
> at
> org.apache.jackrabbit.core.lock.LockManagerImpl.getPath(LockManagerImpl.java:651)
> at
> org.apache.jackrabbit.core.lock.LockManagerImpl.internalLock(LockManagerImpl.java:276)
> at
> org.apache.jackrabbit.core.lock.XAEnvironment$LockInfo.update(XAEnvironment.java:409)
> at
> org.apache.jackrabbit.core.lock.XAEnvironment.prepare(XAEnvironment.java:273)
> ... 38 more
> Caused by: org.apache.jackrabbit.core.state.NoSuchItemStateException:
> 48fb59d8-ac77-4b9f-8b53-9f2492dca5e5
> at
> org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState(SessionItemStateManager.java:189)
> at
> org.apache.jackrabbit.core.HierarchyManagerImpl.getItemState(HierarchyManagerImpl.java:188)
> at
> org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManagerImpl.java:402)
> ... 43 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.