PathNotFoundException on nodes below root
ericasmith Jun 28, 2012 1:48 AMHi everyone,
I have a rather bizarre situation, which has now happened to me twice in the past two months (so alas I can no longer just dismiss it as a fluke).
I am running ModeShape 2.8.1.Final in JBoss AS6, using the standard JBoss AS deployment instructions and storing out to a Postgres database. What happens is this:
My code seems to run correctly for some time, adding items to the repository and updating them, but after some time (often several weeks of healthy running in a developer environment) the repository seems to become corrupt. Some records can still be updated, others silently fail on save (the save code returns without exception or error log, but the next time I try to retrieve that record none of the changes have been persisted).
The most alarming symptom though, is that I completely loose the ability to append new nodes of a particular type to the root node. I stepped through the ModeShape code for this scenario quite closely, and can provide the following details:
The save call has the following requests in it, bundled into a composite request (lines have been trimmed and element names have been changed by hand):
create '/{http://mydomain.com/inf}elGroup'
update '/{http://mydomain.com/inf}elGroup[17]' [{http://www.modeshape.org/1.0}uuid = 0daf3c2b-7491-41e2-91c2-e7f62a387903]
create '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents'
set '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents' [{http://www.modeshape.org/1.0}uuid = 700bc5c8-718a-460b-a229-c9b3bb5f3c93]
create '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents/{http://mydomain.com/inf}contents'
create '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents/{http://mydomain.com/inf}contents/{http://mydomain.com/inf}contentData'
update '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents/{http://mydomain.com/inf}contents/{http://mydomain.com/inf}contentData' [{http://www.modeshape.org/1.0}uuid = 029cf3e8-3bd7-40fe-9f4b-033c44ce9729]
create '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents/{http://mydomain.com/inf}contents/{http://mydomain.com/inf}contentData/{http://www.jcp.org/jcr/1.0}content'
update '/{http://mydomain.com/inf}elGroup[17]/{http://mydomain.com/inf}documents/{http://mydomain.com/inf}contents/{http://mydomain.com/inf}contentData/{http://www.jcp.org/jcr/1.0}content'
The first two embedded requests finish apparently without incident. The third line (the second of the 'create' statements) causes the error:
org.modeshape.graph.property.PathNotFoundException: Unable to find "/{http://mydomain.com/inf}elGroup[17]"; lowest existing path is "/"
at org.modeshape.graph.connector.map.MapRequestProcessor.process(MapRequestProcessor.java:248) [:2.8.1.Final]
at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:250) [:2.8.1.Final]
at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:363) [:2.8.1.Final]
at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:235) [:2.8.1.Final]
at org.modeshape.connector.store.jpa.model.simple.SimpleJpaConnection.execute(SimpleJpaConnection.java:133) [:2.8.1.Final]
at org.modeshape.graph.connector.RepositoryConnectionPool$ConnectionWrapper.execute(RepositoryConnectionPool.java:1124) [:2.8.1.Final]
at org.modeshape.graph.request.CompositeRequestChannel$2.call(CompositeRequestChannel.java:222) [:2.8.1.Final]
at org.modeshape.graph.request.CompositeRequestChannel$2.call(CompositeRequestChannel.java:211) [:2.8.1.Final]
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [:1.6.0_23]
at java.util.concurrent.FutureTask.run(Unknown Source) [:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_23]
at java.lang.Thread.run(Unknown Source) [:1.6.0_23]
According to the REST API, there are indeed 16 'elGroup' items existing before the call is made. 17 should be the next number, so it is picking that correctly, but after creating it and setting its attributes, it seems to be incapable of finding that node again to create a child at the next level.
As noted earlier, this code has previously run without issue, but once the repository starts behaving in this way the only solution I've found is to completely delete it and start with a fresh repository (which is fine during development, but would probably raise some objections in production!)
Can anyone suggest what might be causing the repository to get into this state, and ideally, how to fix it now that it has already done so?
Thanks in advance,
Erica