You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by 小川 貴裕 <og...@brainsellers.com> on 2009/02/13 07:43:50 UTC

InvalidItemStateException on clustering jackrabbit

Dear all,
I'm a test engeneer in Japan.

We deploy jackrabbit-webapp 1.4 for our application to store pdf documents.
And I am reserching how to use jackrabbit on clustering servers.

In our test on clustering jackrabbit with shared repository on MySQL5.1,
An InvalidItemStateException occurs when registering documents
simultaneously from 2 nodes.

--
>Caused by: javax.jcr.InvalidItemStateException:
> cafebabe-cafe-babe-cafe-babecafebabe has been modified externally
> at org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException
> (ServerObject.java:104)
> at
org.apache.jackrabbit.rmi.server.ServerSession.save(ServerSession.java:212)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
--

It seems very serious, but check SQL trace from MySQL, this failed
connection
issues only some select and gives up.

--
> 5 Query SHOW WARNINGS
> 5 Query /* mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} )
*/SELECT @@session.auto_increment_increment
> 5 Query SHOW COLLATION
> 5 Query SET character_set_results = NULL
> 5 Query SET autocommit=1
> 5 Query select BUNDLE_DATA from PM_WS_BUNDLE where NODE_ID =
x'CAFEBABECAFEBABECAFEBABECAFEBABE'
> 5 Query select BUNDLE_DATA from PM_WS_BUNDLE where NODE_ID =
x'C74FA522295945668895FDDFA07BDEF1'
> 5 Query select BUNDLE_DATA from PM_WS_BUNDLE where NODE_ID =
x'2F0E18E2B49343CDADE6B6A5A01F74FE'
--

So, this connection does nothing harm to the repository,
and after a few seconds, same API call succeeds and documents
can be stored and read.

I have tried transaction-isolation setting at my.ini, then,
tried to use Oracle10, but same Exception occurs.

Then, this should be jackrabbit problem, I think.
I've tried FineGrainedISMLocking of jackrabbit, but nothing changed...

It seemes to me that there are many users operating jackrabbit
on clustering servers and no one have met this problem.
So I think something is wrong with us( =repository.xml)...

<<< Please help us. Any suggestion is appreciated. >>>

But Yesterday, I found JCR-1940, it is still opened...

> (JCR-1940)
> Date: Jan 19, 2009 4:41:35 am
> Reporter: Richa Khurana
> Priority: Blocker
>
> We have a enabled jackrabbit clustering. In this mode following
exception occurswhen 2 users simultaneouly add documents to Jack rabbit
repository registeredwith node id 1 and 2 respectively-
>
> 14:59:55,312 ERROR [DocumentHelper] Exception occurred while adding a
manuallyuploaded document to the jackrabbit:
> javax.jcr.InvalidItemStateException:
cafebabe-cafe-babe-cafe-babecafebabe hasbeen modified externally
> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1109)
> at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:846)

...If there is no measure, we have to add some codes to catch this Exception
and retry after a few random seconds.
But I think it should be the last measure.

Thank you for reading long question.

----
Takahiro OGAWA <ogawa(at)brainsellers.com>
<http://www.brainsellers.com/>

----an extract from our repository.xml----
<Repository>

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://192.168.0.131:3306/jackrabbit"/>
<param name="user" value="jackrabbit"/>
<param name="password" value="jackrabbit"/>
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="FS_REPO_"/>
</FileSystem>

<!--
security configuration
-->
<Security appName="Jackrabbit">
<!--
access manager:
class: FQN of class implementing the AccessManager interface
-->
<AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager">
<!-- <param name="config" value="${rep.home}/access.xml"/> -->
</AccessManager>

<LoginModule class="org.apache.catalina.realm.JAASMemoryLoginModule">
<!-- anonymous user name ('anonymous' is the default value) -->
</LoginModule>
</Security>

<!--
location of workspaces root directory and name of default workspace
-->
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>

<!--
workspace configuration template:
used to create the initial workspace if there's no workspace yet
-->
<Workspace name="${wsp.name}">
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://192.168.0.131:3306/jackrabbit"/>
<param name="user" value="jackrabbit"/>
<param name="password" value="jackrabbit"/>
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="FS_WS_"/>
</FileSystem>

<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
<param name="url" value="jdbc:mysql://192.168.0.131:3306/jackrabbit"/>
<param name="user" value="jackrabbit" />
<param name="password" value="jackrabbit" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="PM_WS_"/>
</PersistenceManager>

<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
</SearchIndex>
<ISMLocking
class="org.apache.jackrabbit.core.state.FineGrainedISMLocking">
</ISMLocking>
</Workspace>

<!--
Configures the versioning
-->
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://192.168.0.131:3306/jackrabbit"/>
<param name="user" value="jackrabbit"/>
<param name="password" value="jackrabbit"/>
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="FS_VER_"/>
</FileSystem>

<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
<param name="url" value="jdbc:mysql://192.168.0.131:3306/jackrabbit"/>
<param name="user" value="jackrabbit" />
<param name="password" value="jackrabbit" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="PM_VER_"/>
</PersistenceManager>
<ISMLocking
class="org.apache.jackrabbit.core.state.FineGrainedISMLocking">
</ISMLocking>
</Versioning>

<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
</SearchIndex>

<Cluster id="node1">
<Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
<param name="revision" value="${rep.home}/revision"/>
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://192.168.0.131:3306/jackrabbit"/>
<param name="user" value="jackrabbit"/>
<param name="password" value="jackrabbit"/>
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="JOURNAL_"/>
</Journal>
</Cluster>

</Repository>


Re: InvalidItemStateException on clustering jackrabbit

Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Feb 16, 2009 at 3:16 AM, Takahiro OGAWA <og...@brainsellers.com> wrote:
>> alternatively, you can use locking to prevent concurrent modifications.
>>
> Hmmm... You mean application level locking system by our codes?
>  or use of ISMLocking?

The JCR API provides a locking mechanism on node level.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: InvalidItemStateException on clustering jackrabbit

Posted by Takahiro OGAWA <og...@brainsellers.com>.
Hi, Alexander and Marcel .
Thank you for reply.

Alexander Klimetschek  wrote:

>> But Yesterday, I found JCR-1940, it is still opened...
>>     
>
> I couldn't see any obvious problems in your repository.xml. That
> exception is "normal", see my comment on that issue:
> https://issues.apache.org/jira/browse/JCR-1940
>
>   
>> ...If there is no measure, we have to add some codes to catch this Exception
>> and retry after a few random seconds.
>> But I think it should be the last measure.
>>     
>
> Yes, your code has to be able to handle such exceptions. Have a look
> at the javadocs of the save() methods for more information.
>   

Ah.. InvalidItemStateException in that case is a Checked Exception
 and should be managed by application, I understand.

I mistaked to concern only with environments and settings.
(partly because I am a test engeneer now...)

Ok. Now we understand what to do. Thank you.


Marcel Reutegger wrote:

> On Fri, Feb 13, 2009 at 12:29 PM, Alexander Klimetschek
> <ak...@day.com> wrote:
>   
>> Yes, your code has to be able to handle such exceptions. Have a look
>> at the javadocs of the save() methods for more information.
>>     
>
> alternatively, you can use locking to prevent concurrent modifications.
>
>   
Hmmm... You mean application level locking system by our codes?
 or use of ISMLocking?

...But it is better for me to check JCR API first.
Thank you for your suggestion.

----
Takahiro OGAWA <ogawa(at)brainsellers.com>
<http://www.brainsellers.com/>



Re: InvalidItemStateException on clustering jackrabbit

Posted by Marcel Reutegger <ma...@gmx.net>.
On Fri, Feb 13, 2009 at 12:29 PM, Alexander Klimetschek
<ak...@day.com> wrote:
> Yes, your code has to be able to handle such exceptions. Have a look
> at the javadocs of the save() methods for more information.

alternatively, you can use locking to prevent concurrent modifications.

regards
 marcel

Re: InvalidItemStateException on clustering jackrabbit

Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Feb 13, 2009 at 7:43 AM, 小川 貴裕 <og...@brainsellers.com> wrote:
> It seemes to me that there are many users operating jackrabbit
> on clustering servers and no one have met this problem.
> So I think something is wrong with us( =repository.xml)...
>
>> <<< Please help us. Any suggestion is appreciated. >>>
>
> But Yesterday, I found JCR-1940, it is still opened...

I couldn't see any obvious problems in your repository.xml. That
exception is "normal", see my comment on that issue:
https://issues.apache.org/jira/browse/JCR-1940

> ...If there is no measure, we have to add some codes to catch this Exception
> and retry after a few random seconds.
> But I think it should be the last measure.

Yes, your code has to be able to handle such exceptions. Have a look
at the javadocs of the save() methods for more information.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com