From users-return-11417-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Thu May 07 08:03:14 2009 Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 85678 invoked from network); 7 May 2009 08:03:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 May 2009 08:03:13 -0000 Received: (qmail 25413 invoked by uid 500); 7 May 2009 08:03:12 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 25387 invoked by uid 500); 7 May 2009 08:03:12 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 25374 invoked by uid 99); 7 May 2009 08:03:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 08:03:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of stefan.guggisberg@gmail.com designates 209.85.218.165 as permitted sender) Received: from [209.85.218.165] (HELO mail-bw0-f165.google.com) (209.85.218.165) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 08:02:59 +0000 Received: by bwz9 with SMTP id 9so599404bwz.43 for ; Thu, 07 May 2009 01:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=HYpK0aW4soXDt4JMIwgDdEUwxHtl61MOTrIU/WsOeQg=; b=CYXqdoF3iWt/cpmg0d/vPofVMCeBTnaNEYf2Z/VRNG7EPo/5xR7PxtrecqR7x3uw23 6gwkyWIzUAZyiUHTpmBq29dTvBKgj32hdznWiUumZiR9YLXhadxjXSRCJa92d7S/TXJV 8lCtoSn+xF32WAvs8vrBMdonxUA5u2ZDol5fs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=l8hiooOfGspbTwz0tt+ABSX6mxnw0yT5QgGNyi3ufjHGJXjxCjNok5ATJGAvNbdQhF rUu0SnWlVNB694FmX2rWW5gSSNG+RW5x84J3uyfTDuIVuAwDUp0rfN0V59EUKvoxaWUk 9SgFYDQL6nILcORygl4XB3aMbqtlj4SO46Ewc= MIME-Version: 1.0 Received: by 10.223.126.69 with SMTP id b5mr1388510fas.34.1241683358725; Thu, 07 May 2009 01:02:38 -0700 (PDT) In-Reply-To: <23419555.post@talk.nabble.com> References: <23352361.post@talk.nabble.com> <23376919.post@talk.nabble.com> <23377399.post@talk.nabble.com> <23387753.post@talk.nabble.com> <23389174.post@talk.nabble.com> <90a8d1c00905060111n3027c41ao2f9161a2e365c649@mail.gmail.com> <23419439.post@talk.nabble.com> <23419555.post@talk.nabble.com> Date: Thu, 7 May 2009 10:02:38 +0200 Message-ID: <90a8d1c00905070102p4267128av4831d8e859ca2247@mail.gmail.com> Subject: Re: modified externally: node / when deleting node From: Stefan Guggisberg To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, May 7, 2009 at 5:23 AM, SalmasCM wrote: > > I also forgot to mention, I can see that it's the top node in the XML imp= ort > file that is corrupted. It no longer knows its path or its name. failed t= o > resolve name of 813c0297-0a61-41a8-a80a-e90d4d9cd113. Is it ok to be clon= ing > data imported via XML? yes > > > > SalmasCM wrote: >> >> Stefan: >> >> I do have a clustered environment. Not only this but my application is >> running in BEA Weblogic which tends to spawn a variety of threads. What = do >> you mean when you say "one session/thread"? I am synchronizing and >> locking. >> Could you let me know if it is possible to use Jackrabbit in an >> application server environment and perhaps a small example of how I shou= ld >> be synchronizing and locking? >> Right now my code looks like this: >> >> >> =A0 =A0 =A0 =A0 =A0 =A0 String topName =3D >> DAOFactory.getInstance().getTopLevelNodeNameForType(type); >> =A0 =A0 =A0 =A0 =A0 =A0 removeTopLevelNode(topName); >> =A0 =A0 =A0 =A0 =A0 =A0 Session preview =3D >> JCRConnectionUtil.getInstance().getNewSession(ConnectionManager.PREVIEW_= WORKSPACE); >> =A0 =A0 =A0 =A0 =A0 =A0 previewRoot =3D preview.getRootNode(); >> =A0 =A0 =A0 =A0 =A0 =A0 // JCRUtil.getInstance().lockNode(previewRoot, p= review); >> =A0 =A0 =A0 =A0 =A0 =A0 dataLocation =3D EnvironmentUtil.getDataLoadDir(= ); >> =A0 =A0 =A0 =A0 =A0 =A0 xmlDataLocation =3D dataLocation + "xml/"; >> =A0 =A0 =A0 =A0 =A0 =A0 String fileName =3D xmlDataLocation + topName + = ".xml"; >> =A0 =A0 =A0 =A0 =A0 =A0 logger.info("loading " + fileName); >> =A0 =A0 =A0 =A0 =A0 =A0 InputStream stream =3D CommonUtil.getFile(fileNa= me); >> =A0 =A0 =A0 =A0 =A0 =A0 preview.getWorkspace().importXML("/", stream, >> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); >> =A0 =A0 =A0 =A0 =A0 =A0 preview.save(); >> >> =A0 =A0 =A0 =A0 =A0 =A0 Node nodeToLock =3D previewRoot.getNode(topName)= ; >> =A0 =A0 =A0 =A0 =A0 =A0 synchronized (nodeToLock) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 JCRUtil.getInstance().lockNode(nodeToLoc= k, preview); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Session prod =3D >> JCRConnectionUtil.getInstance().getNewSession(ConnectionManager.PRODUCTI= ON_WORKSPACE); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prod.save(); >> >> prod.getWorkspace().clone(ConnectionManager.PREVIEW_WORKSPACE, "/" + >> topName, "/" + topName, true); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prod.save(); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 JCRUtil.getInstance().unlockNode(nodeToL= ock); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 preview.logout(); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prod.logout(); >> =A0 =A0 =A0 =A0 =A0 =A0 } >> >> =A0 =A0public void lockNode(Node node, Session session) { >> >> =A0 =A0 =A0 =A0 try { >> =A0 =A0 =A0 =A0 =A0 =A0 String nodeWSName =3D >> node.getSession().getWorkspace().getName(); >> =A0 =A0 =A0 =A0 =A0 =A0 String sessionWSName =3D session.getWorkspace().= getName(); >> =A0 =A0 =A0 =A0 =A0 =A0 logLockPath(node); >> =A0 =A0 =A0 =A0 =A0 =A0 if (sessionWSName.equals(nodeWSName)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (node !=3D null && session !=3D null = && !node.isLocked()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 node.addMixin(LOCKABLE_MIXIN); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 node.getSession().save(); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (int i =3D 0; i < MAX_LOCK_U= NLOCK_TRIES; i++) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 node.lock(false, true); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (node.isLocked()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Thread.sleep(LOCK_UNLOCK= _TRIES_SLEEP_INTERVAL); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 node.getSession().save(); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!node.isLocked()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new LockException(= "Cannot grab lock for node >> "); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 } else { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("MISMATCHED W= ORKSPACE!!!: >> node=3D" + >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nodeWSName + " sessionWS= Name " + sessionWSName); >> =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 } catch (NoSuchNodeTypeException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:NoSuchNodeTypeException: " + e); >> =A0 =A0 =A0 =A0 } catch (VersionException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:VersionException: " + e); >> =A0 =A0 =A0 =A0 } catch (ConstraintViolationException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:ConstraintViolationException: " + e); >> =A0 =A0 =A0 =A0 } catch (LockException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode in:= LockException: >> " + e); >> =A0 =A0 =A0 =A0 } catch (UnsupportedRepositoryOperationException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:UnsupportedRepositoryOperationException: " + e); >> =A0 =A0 =A0 =A0 } catch (AccessDeniedException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:AccessDeniedException: " + e); >> =A0 =A0 =A0 =A0 } catch (InvalidItemStateException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:InvalidItemStateException: " + e); >> =A0 =A0 =A0 =A0 } catch (RepositoryException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:RepositoryException: " + e); >> =A0 =A0 =A0 =A0 } catch (InterruptedException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:InterruptedException: " + e); >> =A0 =A0 =A0 =A0 } >> =A0 =A0 } >> >> =A0 =A0 public void unlockNode(Node node) { >> =A0 =A0 =A0 =A0 try { >> =A0 =A0 =A0 =A0 =A0 =A0 if (node !=3D null && node.isLocked()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (int i =3D 0; i < MAX_LOCK_UNLOCK_TR= IES; i++) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 node.unlock(); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!node.isLocked()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Thread.sleep(LOCK_UNLOCK_TRIES_S= LEEP_INTERVAL); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (node.isLocked()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new LockException("Cannot = unlock node "); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 } catch (UnsupportedRepositoryOperationException e) { >> >> getInstance().logger.error("JCRUtil:UnsupportedRepositoryOperationExcept= ion >> in:unlockNode: " + e); >> =A0 =A0 =A0 =A0 } catch (LockException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:LockExceptio= n >> in:unlockNode: " + e); >> =A0 =A0 =A0 =A0 } catch (AccessDeniedException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:AccessDenied= Exception >> in:unlockNode: " + e); >> =A0 =A0 =A0 =A0 } catch (InvalidItemStateException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:InvalidItemS= tateException >> in:unlockNode: " + e); >> =A0 =A0 =A0 =A0 } catch (RepositoryException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:RepositoryEx= ception >> in:unlockNode: " + e); >> =A0 =A0 =A0 =A0 } catch (InterruptedException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 getInstance().logger.error("JCRUtil:lockNode >> in:InterruptedException: " + e); >> =A0 =A0 =A0 =A0 } >> =A0 =A0 } >> >> Stefan Guggisberg wrote: >>> >>> On Tue, May 5, 2009 at 4:56 PM, SalmasCM wrot= e: >>>> >>>> The following errors. >>>> >>>> failed to build path of dd740ff8-5108-40f2-9036-b6c769c86bd5: >>>> cafebabe-cafe-babe-cafe-babecafebabe has no child entry for >>>> dd740ff8-5108-40f2-9036-b6c769c86bd5 >>>> javax.jcr.ItemNotFoundException: failed to build path of >>>> dd740ff8-5108-40f2-9036-b6c769c86bd5: >>>> cafebabe-cafe-babe-cafe-babecafebabe >>>> has no child entry for dd740ff8-5108-40f2-9036-b6c769c86bd5 >>> >>> assuming jcr sessions are used correctly (i.e. not shared among >>> multiple threads) >>> you should never see such an exception in a non-clustered jackrabbit >>> setup. >>> >>> it might be a CachingHierarchyManager bug. please create a jira issue >>> and provide >>> a simple test case for your problem. please also include detailed >>> information about >>> your setup/environment. >>> >>> thanks >>> stefan >>> >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyMan= agerImpl.java:289) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHi= erarchyManager.java:195) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyMan= agerImpl.java:278) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHi= erarchyManager.java:195) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManag= erImpl.java:393) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.CachingHierarchyManager.getPath(CachingHier= archyManager.java:229) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.ItemImpl.getPrimaryPath(ItemImpl.java:213) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.NodeImpl.getPrimaryPath(NodeImpl.java:3240) >>>> =A0 =A0 =A0 =A0at >>>> org.apache.jackrabbit.core.ItemImpl.getPath(ItemImpl.java:1273) >>>> =A0 =A0 =A0 =A0at >>>> com.ashland.valvoline.ui.util.JCRUtil.getNodePath(JCRUtil.java:2353) >>>> >>>> >>>> >>>> Alexander Klimetschek wrote: >>>>> >>>>> On Tue, May 5, 2009 at 4:08 PM, SalmasCM >>>>> wrote: >>>>>> >>>>>> The reason I think its the index is because if I: >>>>>> >>>>>> 1. Load a file in from XML import under /nodeA in workspace 1. >>>>>> 2. Clone nodeA to workspace2 >>>>>> 2. Exit my application. >>>>>> 3. Delete nodeA from workspace 1 and 2 >>>>>> 4. Reload a file in from XML import. >>>>>> 5. Do a XPATH query for a node in the imported data I get errors. >>>>> >>>>> What errors? >>>>> >>>>> Regards, >>>>> Alex >>>>> >>>>> -- >>>>> Alexander Klimetschek >>>>> alexander.klimetschek@day.com >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/modified-externally%3A-node---when-deleting-node= -tp23352361p23389174.html >>>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >> >> > > -- > View this message in context: http://www.nabble.com/modified-externally%3= A-node---when-deleting-node-tp23352361p23419555.html > Sent from the Jackrabbit - Users mailing list archive at Nabble.com. > >