Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8897919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:28:31+00:00 2026-06-15T00:28:31+00:00

I have locked a node using the below code ocm.lock(/path1, true, true); Here the

  • 0

I have locked a node using the below code

ocm.lock("/path1", true, true);

Here the 3rd argument is true which states that it is a Open-scoped Locks.

And it is successfully locked.

But now i am writing a new Java Program to unlock a node.

boolean b1 = ocm.isLocked("/path1");
System.out.println(b1);                      // RETURNS TRUE.
Node n = session.getNode("/path1");
Lock l = n.getLock();
ocm.unlock("/path1", l.getLockToken());

But i am getting a exception here. And it is not unlocking the node.

ERROR [main] ObjectContentManagerImpl.java:957 Cannot unlock path: /path1 Jcr user: admin has no lock token to do this. Lock was placed with user: admin
Exception in thread "main" org.apache.jackrabbit.ocm.exception.IllegalUnlockException
    at org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.unlock(ObjectContentManagerImpl.java:958)
    at ocm.UnlockNode.main(UnlockNode.java:36)

How i can unlock the node?

My UnlockNode.java code.

Repository repository = new URLRemoteRepository("http://localhost:8083/rmi");
Session session = repository.login(new SimpleCredentials("admin","admin".toCharArray()));
Mapper mapper = new AnnotationMapperImpl(classes);
ObjectContentManager ocm = new ObjectContentManagerImpl(session, mapper);

LockManager lm = session.getWorkspace().getLockManager();
lm.addLockToken("a096a79c-5edf-4a17-baa4-aba01f8013d8-J");
boolean b1 = ocm.isLocked("/path1");
System.out.println(b1);
try {
    ocm.unlock("/path1","a096a79c-5edf-4a17-baa4-aba01f8013d8-J");
}catch (Exception e) {
    System.out.println(e);
}

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:28:32+00:00Added an answer on June 15, 2026 at 12:28 am

    Sounds like you’re trying to get the lock from another session…

    java.lang.String getLockToken()

    May return the lock token for this
    lock. If this lock is open-scoped and the current session either holds
    the lock token for this lock, or the repository chooses to expose the
    lock token to the current session, then this method will return that
    lock token. Otherwise this method will return null.

    Either get the lock token, after locking, and store it for later or write your own LockManager with a checkUnlock() method that does what you want it to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have locked cells in a spreadsheet using this lines of code. Range(A1:D23).Select Selection.Locked
I have an application that's locked down using forms authentication. There are few nightly
Im using the npm mongodb driver with node. I have collection.findOne({query}, function(err, result) {
the entries cannot be reordered because one or more of them have been locked
i have two machines. one with a locked down ie9 ... and the other
My storyboard seems locked. I have added new labels and imageviews to two different
I have a MSCRM website set up in IIS 7.5 in which I have
I have been looking at nestedSet behaviour in symfony using doctrine, to display a
I'm developing an application with node.js and socket.io. I have built a small-scale project
On my Drupal site, I have made a Users page using the Views module,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.