hi, On Tue, Mar 25, 2008 at 6:42 AM, Pamarthi, Ramakrishna <[EMAIL PROTECTED]> wrote: > Hi Stefan, > > This is happening only in production system and we are unable to reproduce > the issue in test system. > Yes, we are still using the XMLPersistenceManager with clustering.
AFAIK this configuration is not only unsupported but also strongly discouraged since it bears a very high risk of repository corruption. file system based persistence managers are not transactional, clustering OTOH requires persistence managers storing their data in a standalone database. > > Jackrabbit version : 1.3.3 > > We want to delete the corrupt nodes from system. > > Please kindly advise. while you probably could fix your current issue by manually editing the xml files in question (have a look at the XMLPersistenceManager code and you'll get the idea) i'd strongly suggest you migrate your repository content to a db-based persistence manager. you will probably have to write a custom migration tool but that shouldn't be too hard. you'll basically have to read NodeState etc. instances using your current persistence manager and write them back using your new one. cheers stefan > > Best Regards, > RK > > > -----Original Message----- > From: Stefan Guggisberg [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2008 7:25 PM > To: [email protected] > Subject: Re: javax.jcr.ReferentialIntegrityException - the node cannot be > removed because it is still being referenced. > > hi > > On Tue, Mar 18, 2008 at 10:51 AM, Pamarthi, Ramakrishna <[EMAIL PROTECTED]> > wrote: > > Dear All, > > > > We are getting the following error. Any idea? > > i couldn't spot anything obviously wrong in your code sample. > does the problem occur with a specific node only? if yes then my first bet > would be a corrupt repository... are you still using XMLPersistenceManager? > > if the problem's reproduceable please create jira issue, if possible provide > a simple test case (or at least detailed instructions how to reproduce the > problem with an out-of-the-box jackrabbit) and detailed information about > your environment, jackrabbit version and configuration. > > cheers > stefan > > > > > at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) > > at org.apache.catalina.connector.CoyoteAdapter.service(Unknown > Source) > > at org.apache.jk.server.JkCoyoteHandler.invoke(Unknown Source) > > at org.apache.jk.common.HandlerRequest.invoke(Unknown Source) > > at org.apache.jk.common.ChannelSocket.invoke(Unknown Source) > > at org.apache.jk.common.ChannelSocket.processConnection(Unknown > Source) > > at org.apache.jk.common.SocketConnection.runIt(Unknown Source) > > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source) > > at java.lang.Thread.run(Thread.java:595) > > Caused by: com.hp.ocs.content.InvalidContentException: Cannot save the > node [id=?none(node not saved yet)?, > path=/ocs:repository/ocs:content/it_VA/newsTopic]. > > at > com.hp.ocs.content.NodeManager.handleRepositoryException(NodeManager.java:931) > > at com.hp.ocs.content.NodeManager.saveNode(NodeManager.java:60) > > at com.hp.ocs.content.ContentBase.remove(ContentBase.java:182) > > ... 41 more > > Caused by: javax.jcr.ReferentialIntegrityException: > e913439f-60a3-40cb-bc4d-b4fec3c25156: the node cannot be removed because it > is still being referenced. > > at > org.apache.jackrabbit.core.state.SharedItemStateManager.checkReferentialIntegrity(SharedItemStateManager.java:1400) > > at > org.apache.jackrabbit.core.state.SharedItemStateManager$Update.begin(SharedItemStateManager.java:556) > > at > org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate(SharedItemStateManager.java:825) > > at > org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:855) > > at > org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:326) > > at > org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:313) > > at > org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:302) > > at > org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:306) > > at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1240) > > at > > com.hp.ocs.content.NodeManager.saveNode(NodeManager.java:55) > > > > > > Here are the functions: > > > > public void remove() throws InvalidContentException { > > try { > > Node parentNode = NodeManager.getParentNode(node); > > NodeManager.removeNode(node); > > NodeManager.saveNode(parentNode); > > } catch (InvalidContentException e) { > > throw new InvalidContentException(MessageFormat.format( > > "Cannot remove the node", > > new Object[] { node }), e); > > } > > } > > > > public static void removeNode(Node node) throws InvalidContentException { > > try { > > synchronized (ContentUtils.JCR_WRITE_LOCK) { > > removeReferences(node); > > node.remove(); > > } > > } catch (RepositoryException e) { > > Object[] params = {toString(node)}; > > String msg = MessageFormat > > .format("Cannot remove node {0}.", > params); > > handleRepositoryException(msg, e, true); > > } > > } > > > > private static void removeReferences(Node node) > > throws InvalidContentException, > RepositoryException { > > PropertyIterator iter = node.getReferences(); > > String uuid = node.getUUID(); > > while (iter.hasNext()) { > > Property ref = iter.nextProperty(); > > Value[] values = ref.getValues(); > > for (int i = 0; i < values.length; i++) { > > if (StringUtils.equals(uuid, > values[i].getString())) { > > values[i] = null; > > } > > } > > Node parent = ref.getParent(); > > setValues(parent, ref.getName(), values); > > saveNode(parent); > > } > > } > > > > > > Best Regards, > > RK > > >
