jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Herman" <MHer...@NBME.org>
Subject RE: "Item cannot be saved because it has been modified externally"
Date Wed, 17 Aug 2011 18:01:07 GMT
Not familiar with OCM, but that error is just saying that you're trying to
lock a node that doesn't have the correct mixin applied.  By default most
node types aren't lockable unless you add it.  You could see what mixins are
on the object by browsing:
node.getMixinNodeTypes();

and add it by:
node.addMixin(JcrConstants.MIX_LOCKABLE);

-----Original Message-----
From: Will Scheidegger [mailto:willscheidegger@mac.com] 
Sent: Wednesday, August 17, 2011 1:03 AM
To: users@jackrabbit.apache.org
Subject: Re: "Item cannot be saved because it has been modified externally"

Unfortunately this did not solve the problem. Now I'm getting this exception:

org.apache.jackrabbit.ocm.exception.RepositoryException: Node of type is not
type mix:lockable; nested exception is javax.jcr.lock.LockException: Unable
to perform a locking operation on a non-lockable node: /path/to/node/1093
javax.jcr.lock.LockException: Unable to perform a locking operation on a
non-lockable node: /path/to/node/1093
	at
org.apache.jackrabbit.core.lock.SessionLockManager.checkLockable(SessionLockM
anager.java:223)
	at
org.apache.jackrabbit.core.lock.SessionLockManager.lock(SessionLockManager.ja
va:157)
	at org.apache.jackrabbit.core.NodeImpl.lock(NodeImpl.java:4609)
	at
org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.lock(ObjectCo
ntentManagerImpl.java:920)
	...
Does anyone have an idea what I could do next? Thanks!!

-will

On 16.08.2011, at 14:04, Will Scheidegger wrote:

> We're on 1.6.2 and we cannot upgrade:
> - I don't think OCM is available for Jackrabbit 2
> - The CMS version (Magnolia) requires this version of Jackrabbit
> 
> I have modified my code as follows in the meantime:
> 
>                    ObjectContentManager ocm =
getObjectContentManager("data");
>                    Lock lock = ocm.lock(cardOrder.getPath(), true, true);
>                    ocm.update(cardOrder);
>                    ocm.save();
>                    ocm.unlock(cardOrder.getParentPath(),
lock.getLockToken());
> 
> To be honest, I do not really know what I'm doing here but according to the
Javadoc this might do the trick. The code actually works, but I cannot tell
yet, if it solves our problem (the problem never occurs on the development
machines).
> 
> -will
> 
> On 16.08.2011, at 13:03, Craig Ganoe wrote:
> 
>> 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(ObjectCo
ntentManagerImpl.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