jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klemens.Let...@signal-iduna.de
Subject Lock/unlock nodes in a clustered environment
Date Tue, 05 Apr 2011 09:37:13 GMT
Hello,

we have a problem with locking and unlocking of nodes in our clustered 
environment. We keep getting javax.jcr.lock.LockException: Precondition 
Failed errors caused by  Caused by: 
org.apache.jackrabbit.webdav.DavException: Precondition Failed. We are not 
sure whether this is a communication problem or a session/cluster based 
error. 

We are a using Jackrabbit 2.2.4 deployed as repository server on websphere 
unsing  two cluster nodes which are directly connected to a DB 2 database. 
The errors occur randomly but constantly 
when we execute our testcase trying to add several nodes one after 
another. A JCR-WebDAV .doc stated the error as: 

412 (Precondition Failed) – if the lock token transmitted with the 
TransactionId header is not a transaction lock token or is invalid.

This is how our testcase looks like:


dmsSession = ... .loginRepository();
Node nodeToAddMixin = dmsSession.getNode("Path to node");
if (nodeToAddMixin.canAddMixin(NodeType.MIX_LOCKABLE)) {
        nodeToAddMixin.addMixin(NodeType.MIX_LOCKABLE);
        dmsSession.save();
}

lockManager = dmsSession.getWorkspace().getLockManager();
boolean isLocked = lockManager.isLocked("Path to node");

        ... wait till unlocked

        if (!isLocked) {
                lock = lockManager.lock("Path to node", true, false, 10, 
"");
                lockManager.addLockToken(lock.getLockToken());
      }

        ... do stuff with locked node

       if (lockManager != null) {
            try {
                if (lockManager.isLocked("Path to node")) {
                    if (dmsSession.hasPendingChanges()) {
                        dmsSession.save();
                    }
                    lockManager.unlock("Path to node");
                }
            } catch (RepositoryException e) {
                dmsSession.logout();
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

dmsSession.save();
dmsSession.logout();


Does somebody know about bugs in the communication layer or obvious 
programming mistakes we might have made?


Greets

Klemens Letulé





SIGNAL Krankenversicherung a. G., Sitz: Dortmund, HR B 2405, AG Dortmund
IDUNA Vereinigte Lebensversicherung aG für Handwerk, Handel und Gewerbe,
Sitz: Hamburg, HR B 2740, AG Hamburg
Deutscher Ring Krankenversicherungsverein a.G., Sitz: Hamburg,
HR B 4673, AG Hamburg,
SIGNAL IDUNA Allgemeine Versicherung AG, Sitz: Dortmund, HR B 19108, 
AG Dortmund
Vorstände: Reinhold Schulte (Vorsitzender),
Dr. Karl-Josef Bierth,Jens O. Geldmacher, Marlies Hirschberg-Tafel,
Michael Johnigk, Ulrich Leitermann, Michael Petmecky,
Dr. Klaus Sticker, Prof. Dr. Markus Warg 
Vorsitzender der Aufsichtsräte: Günter Kutz
SIGNAL IDUNA Gruppe Hauptverwaltungen, Internet: www.signal-iduna.de
44121 Dortmund, Hausanschrift: Joseph-Scherer-Str. 3, 44139 Dortmund
20351 Hamburg, Hausanschrift: Neue Rabenstraße 15-19, 20354 Hamburg

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message