jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Gaeremynck <gaeremyn...@gmail.com>
Subject EventListener on Event.NODE_ADDED results in InvalidItemStateException
Date Tue, 06 Oct 2009 11:23:03 GMT
Hi,

I am listening to the repository (at '/' )  to look for files who get
uploaded trough WebDAV.
So I am listening to events of NODE_ADDED for types of nt:file and who are
deep.

When I get such an event I want to add a couple of properties and a mixin on
it.
For each event I create a new session and grab the node at the specified
path (from the event.getPath() method.)

Everything works fine. But as soon as I want to save my session I get an
InvalidItemStateException. [1] Full stacktrace

I think this is probably because there is still some indexing that JCR takes
care of and thus modifies the node as well ?
The strange thing is, that it is the root node who is modified and not the
uploaded file.

For now I have a nasty workaround which just tries to save, catches the
exception (if any) yields the thread and then tries again.
This is obviously not what I want.
Full code can be found at [2]

If it helps I am using Mac OS X 10.6.1 with the built-in WebDAV client in
Finder using java 1.6.0_15

Can anyone shed some light on why I am getting this exception and what I
should do to prevent it?

Kind regards,

Simon


[1]
06.10.2009 11:41:18.075 *ERROR* [ObservationManager]
org.sakaiproject.kernel.files.FileObserver Item cannot be saved because it
has beenmodified externally: node / javax.jcr.InvalidItemStateException:
Item cannot be saved because it has beenmodified externally: node /
    at
org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:246)
    at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1085)
    at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:846)
    at
org.apache.sling.jcr.base.internal.PooledSession.save(PooledSession.java:256)
    at
org.sakaiproject.kernel.files.FileObserver$1.onEvent(FileObserver.java:114)
    at
org.apache.jackrabbit.core.observation.EventConsumer.consumeEvents(EventConsumer.java:243)
    at
org.apache.jackrabbit.core.observation.ObservationDispatcher.run(ObservationDispatcher.java:145)
    at java.lang.Thread.run(Thread.java:613)
javax.jcr.InvalidItemStateException: Item cannot be saved because it has
beenmodified externally: node /
    at
org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:246)
    at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1085)
    at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:846)
    at
org.apache.sling.jcr.base.internal.PooledSession.save(PooledSession.java:256)
    at
org.sakaiproject.kernel.files.FileObserver$1.onEvent(FileObserver.java:114)
    at
org.apache.jackrabbit.core.observation.EventConsumer.consumeEvents(EventConsumer.java:243)
    at
org.apache.jackrabbit.core.observation.ObservationDispatcher.run(ObservationDispatcher.java:145)
    at java.lang.Thread.run(Thread.java:613)

[2] http://paste2.org/p/454952

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message