You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by viz06 <vi...@yahoo.com> on 2008/05/24 17:12:15 UTC

Unlocking: Node not locked by this session

I have a very simple setup using spring module jcrTemplate. I am able to lock
a node using


Lock nodeLock = jcrTemplate.getNodeByUUID(<myUUID>).lock(false, false);

and this is how I am attempting unlocking

jcrTemplate.getSessionFactory().getSession().addLockToken(nodeLock
.getLockToken());


jcrTemplate.getNodeByUUID(<myUUID>).unlock();

this results in

javax.jcr.lock.LockException: Node not locked by this session.
	at
org.apache.jackrabbit.core.lock.XAEnvironment.unlock(XAEnvironment.java:162)
	at
org.apache.jackrabbit.core.lock.XALockManager.unlock(XALockManager.java:122)
	at org.apache.jackrabbit.core.NodeImpl.unlock(NodeImpl.java:4173)


the calls to lock and unlock are called from 2 different unit test methods.

I know its some silly mistake from my part but I am unable to find it even
after searching forum data nd the jsr-170 reference.

TIA,
Viz


-- 
View this message in context: http://www.nabble.com/Unlocking%3A-Node-not-locked-by-this-session-tp17448831p17448831.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Unlocking: Node not locked by this session

Posted by viz06 <vi...@yahoo.com>.
this is a bug in Jackrabbit implementation and here is the jira issue that is
logged against this https://issues.apache.org/jira/browse/JCR-1634 

Add in your vote as this would help in getting it resolved quicker.
-- 
View this message in context: http://www.nabble.com/Unlocking%3A-Node-not-locked-by-this-session-tp17448831p17797342.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Unlocking: Node not locked by this session

Posted by silviu_rosu <si...@yahoo.com>.
I have the same problem. I try to unlock the node from another transaction,
and I receive another session with a different Id. In this session I see
that I don't have anything in lockHolder.
And that's why I receive the same error that this node has been locked by
another session.
Have you resolved this problem. I realy need help with this because I'm
struggling for two days to resolve it. 

Thanks
-- 
View this message in context: http://www.nabble.com/Unlocking%3A-Node-not-locked-by-this-session-tp17448831p17796029.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Unlocking: Node not locked by this session

Posted by viz06 <vi...@yahoo.com>.
Thanks Jukka for chiming in,

Unfortunately this didn't work for me. I am getting the same exception after
making changes. Just to make it more clear my lock and unlock calls are
running under different transaction as I need to test if the same user can
unlock a node locked by him previously. 

Under such condition can I expect to get the same session (which locked the
node initially) by calling node.getSession() while unlocking? 

Thanks Again
-- 
View this message in context: http://www.nabble.com/Unlocking%3A-Node-not-locked-by-this-session-tp17448831p17455720.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Unlocking: Node not locked by this session

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Sat, May 24, 2008 at 6:12 PM, viz06 <vi...@yahoo.com> wrote:
> I have a very simple setup using spring module jcrTemplate. I am able to lock
> a node using
>
> Lock nodeLock = jcrTemplate.getNodeByUUID(<myUUID>).lock(false, false);
>
> and this is how I am attempting unlocking
>
> jcrTemplate.getSessionFactory().getSession().addLockToken(nodeLock
> .getLockToken());
>
> jcrTemplate.getNodeByUUID(<myUUID>).unlock();

Do you still have a reference to the original Node instance that you
locked. The easiest way to unlock it is to call unlock() on that node
instance as it's still associated with the session that originally
locked the node.

Otherwise, try the following code snippet, as the lock token needs to
be associated with the same session that does the unlocking:

    Node node = jcrTemplate.getNodeByUUID(<myUUID>);
    node.getSession().addLockTiken(<lockToken>);
    node.unlock();

BR,

Jukka Zitting