jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pamarthi, Ramakrishna" <rk.pamar...@hp.com>
Subject RE: javax.jcr.ReferentialIntegrityException - the node cannot be removed because it is still being referenced.
Date Tue, 25 Mar 2008 05:42:00 GMT
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.

Jackrabbit version : 1.3.3

We want to delete the corrupt nodes from system.

Please kindly advise.

Best Regards,
RK
-----Original Message-----
From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
Sent: Thursday, March 20, 2008 7:25 PM
To: users@jackrabbit.apache.org
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 <rk.pamarthi@hp.com> 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
>

Mime
View raw message