jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Ivanov" <stefko.iva...@gmail.com>
Subject Re: Problem in Multithreaded Environment
Date Sun, 13 Jan 2008 23:41:07 GMT
Hi Dan

I have the same problem. I tried this with Local and XA Transaction Manager
but still ... :-(
I use 1.3.3 and at the moment I'm happier with the Local Transaction
Manager.

I've done different things to avoid this: reorganization of the data
structure tree, unique node names but the problem is still here.

Stefan



2008/1/12, Dan Diephouse <dan.diephouse@mulesource.com>:
>
> Dan Diephouse wrote:
> > Heya, I think I'm probably doing something pretty stupid here, but I'm
> > having a few problems using Jackrabbit in a multithreaded environment.
> > If you can imagine I have this scenario:
> >
> > Thread #1 running inside my unit test which is doing stuff to the
> > repository all in one session.
> > Thread #2 which is reading stuff inside the repository and updating
> > some nodes
> >
> > I think occasionally these threads collide though and start modifying
> > the same node. Then I starting getting things like:
> >
> > javax.jcr.RepositoryException: failed to create transient state:
> > there's already a property state instance with id
> > 1d038015-6c48-4654-a685-1dcf57a6bf6f/{
> http://www.jcp.org/jcr/1.0}mixinTypes:
> > there's already a property state instance with id
> > 1d038015-6c48-4654-a685-1dcf57a6bf6f/{
> http://www.jcp.org/jcr/1.0}mixinTypes
> >
> >    at
> > org.apache.jackrabbit.core.PropertyImpl.getOrCreateTransientItemState(
> PropertyImpl.java:97)
> >
> >    at
> > org.apache.jackrabbit.core.PropertyImpl.restoreTransient(
> PropertyImpl.java:143)
> >
> >    at
> > org.apache.jackrabbit.core.ItemImpl.restoreTransientItems(ItemImpl.java
> :734)
> >
> >    at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1233)
> >    at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:849)
> > ...
> > Caused by: org.apache.jackrabbit.core.state.ItemStateException:
> > there's already a property state instance with id
> > 1d038015-6c48-4654-a685-1dcf57a6bf6f/{
> http://www.jcp.org/jcr/1.0}mixinTypes
> >
> >    at
> >
> org.apache.jackrabbit.core.state.SessionItemStateManager.createTransientPropertyState
> (SessionItemStateManager.java:629)
> >
> >    at
> > org.apache.jackrabbit.core.PropertyImpl.getOrCreateTransientItemState(
> PropertyImpl.java:90)
> >
> >    ... 42 more
> >
> > Or:
> >
> > javax.jcr.RepositoryException: failed to create transient state:
> > there's already a property state instance with id
> > 1d038015-6c48-4654-a685-1dcf57a6bf6f/{http://www.jcp.org/jcr/1.0}uuid:
> > there's already a property state instance with id
> > 1d038015-6c48-4654-a685-1dcf57a6bf6f/{http://www.jcp.org/jcr/1.0}uuid
> >    at
> > org.apache.jackrabbit.core.PropertyImpl.getOrCreateTransientItemState(
> PropertyImpl.java:97)
> >
> >    at
> > org.apache.jackrabbit.core.PropertyImpl.restoreTransient(
> PropertyImpl.java:143)
> >
> >    at
> > org.apache.jackrabbit.core.ItemImpl.restoreTransientItems(ItemImpl.java
> :734)
> >
> >    at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1233)
> >    at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:849)
> > ....
> > Caused by: org.apache.jackrabbit.core.state.ItemStateException:
> > there's already a property state instance with id
> > 1d038015-6c48-4654-a685-1dcf57a6bf6f/{http://www.jcp.org/jcr/1.0}uuid
> >    at
> >
> org.apache.jackrabbit.core.state.SessionItemStateManager.createTransientPropertyState
> (SessionItemStateManager.java:629)
> >
> >    at
> > org.apache.jackrabbit.core.PropertyImpl.getOrCreateTransientItemState(
> PropertyImpl.java:90)
> >
> >    ... 42 more
> >
> > If the second thread was accessing a node created by the first thread
> > and the node wasn't saved yet, would that explain these errors?
> >
> > Any ideas how to avoid this???
> >
>
> One other thing. Those exceptions are from thread #2. I get this
> exception from thread #1:
>
> org.springframework.dao.ConcurrencyFailureException: Invalid item state;
> nested exception is javax.jcr.InvalidItemStateException: /activities:
> the node cannot be saved because it has been modified externally.
>
> Caused by: javax.jcr.InvalidItemStateException: /activities: the node
> cannot be saved because it has been modified externally.
>    at org.apache.jackrabbit.core.NodeImpl.makePersistent(NodeImpl.java
> :969)
>    at
> org.apache.jackrabbit.core.ItemImpl.persistTransientItems(ItemImpl.java
> :687)
>    at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1198)
>    at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:849)
>
> Cheers,
> - Dan
>
> --
> Dan Diephouse
> MuleSource
> http://mulesource.com | http://netzooid.com/blog
>
>

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