jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Ganoe <cga...@psu.edu>
Subject Re: "Item cannot be saved because it has been modified externally"
Date Tue, 16 Aug 2011 11:03:42 GMT
What version of Jackrabbit are you using? If it's a significantly  
older version, I'd suggest upgrading to the latest possible. We had  
this issue, and upgrading eliminated it.

On Aug 16, 2011, at 6:12 AM, Will Scheidegger wrote:
> Dear Jackrabbit experts
>
> I'm facing a strange problem where sometimes we get an  
> InvalidStateException with an error message like this:
>
> javax.jcr.InvalidItemStateException: Item cannot be saved because it  
> has been modified externally: node /
> org.apache.jackrabbit.ocm.exception.ObjectContentManagerException:  
> Cannot persist current session changes.; nested exception is  
> javax.jcr.InvalidItemStateException: Item cannot be saved because it  
> has been modified externally: node /
> javax.jcr.InvalidItemStateException: Item cannot be saved because it  
> has been modified externally: node /
> 	at  
> org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java: 
> 246)
> 	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:942)
> 	at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:915)
> 	at  
> org 
> .apache 
> .jackrabbit 
> .ocm 
> .manager 
> .impl.ObjectContentManagerImpl.save(ObjectContentManagerImpl.java: 
> 1070)
> ....
>
> The node which cannot be saved varies. Here it seems to be the root  
> node but it can be next to anything.
>
> Now my uneducated guess is that we have a concurrent access problem  
> (several requests of our webapplication trying to update the same  
> node or a node in the same path or ...?). If you agree with me would  
> you mind giving me some pointers on how to resolve this problem  
> properly? Of course I cannot lock a node forever. From when to when  
> do I have to lock it?
>
> More info:
> - We're working with OCM
> - The error occurs when we're trying to persist a bean to the  
> repository.
> - The code which does that looks like this:
>
>                    ObjectContentManager ocm =  
> getObjectContentManager("data"); // gets the ObjectContentMananger  
> for the "data" repository
>                    ocm.update(cardOrder);  // cardOrder is my bean  
> which needs to be persisted. It already exists in the repository
>                    ocm.save();
>
> Any help is warmly appreciated!
>
> -will
>


Mime
View raw message