Page 1 of 3

es.git.openkm.core.LockException: Node locked.

PostPosted:Wed Dec 03, 2008 5:30 am
by teeger
After I upload file with \'&\' sign the program will not let me delete it. I get this:
Code: Select all
ERROR [DirectDocumentModule] Node locked.
javax.jcr.lock.LockException: Node locked.
        at org.apache.jackrabbit.core.lock.XALockManager.checkLock(XALockManager.java:180)
        at org.apache.jackrabbit.core.NodeImpl.checkLock(NodeImpl.java:4232)
        at org.apache.jackrabbit.core.NodeImpl.restore(NodeImpl.java:3091)
        at es.git.openkm.module.direct.DirectDocumentModule.cancelCheckout(DirectDocumentModule.java:755)
        at es.git.openkm.api.OKMDocument.cancelCheckout(OKMDocument.java:182)
        at es.git.openkm.frontend.server.OKMDocumentServlet.cancelCheckout(OKMDocumentServlet.java:204)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        at java.lang.Thread.run(Thread.java:595)
00:18:49,709 ERROR [OKMDocumentServlet] Node locked.
es.git.openkm.core.LockException: Node locked.
        at es.git.openkm.module.direct.DirectDocumentModule.cancelCheckout(DirectDocumentModule.java:776)
        at es.git.openkm.api.OKMDocument.cancelCheckout(OKMDocument.java:182)
        at es.git.openkm.frontend.server.OKMDocumentServlet.cancelCheckout(OKMDocumentServlet.java:204)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        at java.lang.Thread.run(Thread.java:595)
Caused by: javax.jcr.lock.LockException: Node locked.
        at org.apache.jackrabbit.core.lock.XALockManager.checkLock(XALockManager.java:180)
        at org.apache.jackrabbit.core.NodeImpl.checkLock(NodeImpl.java:4232)
        at org.apache.jackrabbit.core.NodeImpl.restore(NodeImpl.java:3091)
        at es.git.openkm.module.direct.DirectDocumentModule.cancelCheckout(DirectDocumentModule.java:755)
        ... 30 more
Filesystem intergrity is OK running on GNU/Linux 2.6.18-6-686

file permission owned by ROOT , JBOSS/bin/run.sh running as ROOT tried OpenKM logon with admin (formly system) and still throws error. running latest stable build ver 3.0

please advise on next steps

Re:es.git.openkm.core.LockException: Node locked.

PostPosted:Tue Dec 09, 2008 12:38 pm
by pavila
Unable to reproduce the issue, can you give me more info (filename, for example)?

Re:es.git.openkm.core.LockException: Node locked.

PostPosted:Fri Apr 17, 2009 11:46 am
by ribizli
Hi pavila,

we\'ve got some kind of \'Lock\' error message, too.

We can\'t check-in or cancel the checkout for a specific document. But it seems so, that the error is related to the transaction handling not to the locking. Sorry, but I haven\'t any glue how the users put the document into this state, but I can\'t resolve it.

Attached can you find the related log part.


PS: there are some other opened issues (other unanswered forum posts) from our side, could you please process them too? [file name=log_txn_error.txt size=17940]http://www.openkm.com/images/fbfiles/fi ... _error.txt[/file]

Re:es.git.openkm.core.LockException: Node locked.

PostPosted:Fri Apr 17, 2009 12:44 pm
by ribizli
Hi pavila,

I know what happened. I\'ve changed the login logic to logout the old session if the same user logs in into the system (to avoid the 30 min waiting time if the browser was closed accidentally and the session was lost). I think my implementation was not correct and there exists two opened Jackrabbit sessions now. Here is my code:

DirectAuthModule:
Code: Select all
SessionManager sessions = SessionManager.getInstance();
String oldToken = sessions.getTokenByUserId(session.getUserID());

if (oldToken != null) {
  Session oldSession = sessions.getInfo(oldToken).getSession();
  oldSession.logout();
  sessions.remove(oldToken);
}
I think the \'oldSession.logout\' is not enough, is it? Should I call the AuthModule.logout(oldToken) too?

My second question is: How can I close now the locking session?

Thanks in advance.

Re:es.git.openkm.core.LockException: Node locked.

PostPosted:Sun Apr 19, 2009 9:37 am
by pavila
The modifications in this part of code are specially dangerous and I don\'t recommend you touching this. These modifications can lead on several application dysfunctions.

An please, if you have modified the code you should specify it clearly in the question!

Which others questions are opened?

Re:es.git.openkm.core.LockException: Node locked.

PostPosted:Mon Apr 27, 2009 6:59 am
by ribizli
Sorry about the late answer, but I was on a training last week.

About the issue above: my corrections work fine, but the locked files cannot be unlocked anymore regarding the topics I\'ve found about Jackrabbit. I deleted the nodes directly from the database as a 50% solution (because the same file name cannot be used in the folder).

I\'ll collect all still opened questions and post them in an affected topic later.

Thanks.

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Tue Dec 15, 2009 3:32 am
by pejbx
Are you all saying that there is no way to cancel a checkout on a file. When the user logs in for the file that says it is checked out, the icon in the bottom left corner says there are zero files checked out for this user.

We can not cancel checkout, delete or upload and overwrite the checked out file, WHAT CAN WE DO?
thanks,

PJ

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Wed Dec 16, 2009 12:12 am
by pavila
The lock token seems to be lost. You have to perform some low-level modifications in the repository to recover the lost token. Not an easy or recommended task if you don't have a good backup before it.

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Wed Dec 16, 2009 12:50 am
by pejbx
We are experienced Linux programmers, can you supply instructions to perform the low level tasks you refer to.

Also, how does this happen and how can we prevent this in the future?

Thanks,

PJ

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Thu Dec 17, 2009 10:05 am
by pavila
You have to get the lock node UUID, generate a new lock token and add it to the user session. Refer to Jackrabbit wiki list for more info.

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Mon Mar 01, 2010 4:56 pm
by arnk
Please can somebody help we - we have exactly the same problem with one of our most important files. The user checked it in OK, but at somepoint the network connection went down and now its in a locked state. As admin I can't unlock it - I am quite happy to force it back to a previous version if that was possible. I really need a solution for this thanks.

I would delete the lock file if I knew where to find it.

Alastair

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Tue Mar 02, 2010 12:40 pm
by pavila
You can generate a lock token invoking this method:
Code: Select all
com.openkm.util.JCRUtils.getLockToken(String id)
The "id" paramter is the locked document UUID. Once this lock token is generated, you should add this generated lock token to the user configuration. I mean, the user who make the lock. Before modify the user configuration, make sure the user is logged out.

Now log as okmAdmin and after that, go to http://localhost:8080/OpenKM/admin/repository_view.jsp. Now go to /okm:home/user_id/okm:config and edit the okm:lockTokens property. Add the previous generated.

Log as user_id and unlock the document.

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Wed Mar 17, 2010 11:07 pm
by arnk
Thanks for the help, but despite reading as much as I can find I still haven't figured out how to create the new token yet.
I assume that I need to write some Java to call com.openkm.util.JCRUtils.getLockToken(String id), compile it and then run it and get it to print out this new token. The rest of the instructions look OK. I have the id for the locked file. Have you got a script to create this token please?
Thanks
Al

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Thu Mar 18, 2010 9:27 am
by pavila
Yes, you are right. You should write a little program to call this method.

Re: es.git.openkm.core.LockException: Node locked.

PostPosted:Mon May 10, 2010 1:02 am
by arnk
I finally worked this out - apologies if this solution is not very elegant but its what worked for me on Windows with Java JDK 1.6 installed

1) Login as user who locked file and get the uuid of their locked document
2) Download the latest OpenKM 4.1 and extract the zip file to somewhere like C:\Users\Username\Files\OpenKM-4.1_JBoss-4.2.3.GA.zip
3) Go to C:\Users\Alastair\Files\OpenKM-4.1_JBoss-4.2.3.GA.zip\OpenKM-4.1_JBoss-4.2.3.GA\server\default\deploy and use 7-Zip to extract the OpenKM.war file into a new directory OpenKm
4) Open a cmd prompt (I used admin priviledges) and go to this directory
Code: Select all
cd C:\Users\Username\Files\OpenKM-4.1_JBoss-4.2.3.GA.zip\OpenKM-4.1_JBoss-4.2.3.GA\server\default\deploy\OpenKM\WEB-INF
5) Create a text file like this
Code: Select all
import es.git.openkm.util.JCRUtils;

public class GenerateId 
{
	public GenerateId() 
	{
		main(null);
	}

	public static void main(String[] args) 
	{
                // this is the uuid of the locked document
		String key = "9606a571-a177-49f3-a884-c41632a12345";
		String locktoken = JCRUtils.getLockToken(key);
		System.out.println(locktoken);
	}
}
6) Save this file as GenerateId.java in this directory
7) Type this at the cmd prompt
Code: Select all
set CLASSPATH=.;.\classes;.\lib\jcr-1.0.jar;.\lib\slf4j-api-1.5.3.jar;.\lib\slf4j-log4j12-1.5.3.jar;.\..\..\..\lib\log4j.jar
8) Compile the java program
Code: Select all
javac GenerateId.java
9) Run the java program
Code: Select all
java GenerateId
10) A UUID is created a bit like this
Code: Select all
9606a571-a177-49f3-a884-c41632a12345-6
11) Login as admin into OpenKM
12) Go to http://localhost:8080/OpenKM/repository_view.jsp (I am using version 3.0)
13) Click on the okm:home in the Childs section at the bottom
14) Click on the username (who has the locked file) in the Childs section at the bottom
15) Click on the okm:config in the Childs section at the bottom
16) Click on the edit link next to okm:lockTokens and paste in the UUID created in 10)
17) Logout as admin and login as the username with the locked file
18) Unlock the file

I hope this helps somebody else!

Al