-
1. Exception using the Jcr Connector to Jackrabbit
rhauch Mar 23, 2011 10:54 AM (in response to a.novarini)I think the problem you're experiencing is because the Jackrabbit repository contains node types that are not known to ModeShape. For example, the "rep" namespace is non-standard and repository-specific. I thought Jackrabbit had several of these; ModeShape uses the "mode" and "modeint" namespaces in a similar way.
At this time, the JCR connector isn't able to expose the node types dynamically to the ModeShape JCR layer, so you have to make sure that ModeShape has all of the node types that are used in the connector's repository.
I'd try putting all the node type definitions from these Jackrabbit-specific namespaces and any other non-standard node types within the connector's repository into one or more CND files, and then registering those node types by specifying the CND file(s) in the ModeShape configuration.
-
2. Exception using the Jcr Connector to Jackrabbit
a.novarini Mar 23, 2011 11:01 AM (in response to rhauch)Ok, this surely makes a lot of sense.
Thanks for the advice.
Ragards,
Ale
-
3. Re: Exception using the Jcr Connector to Jackrabbit
a.novarini Mar 24, 2011 11:08 AM (in response to a.novarini)Hello again,
I added the cnd file with the custom nodes for jackrabbit and modeshape didn't complain anymore, so I tried to go further.
Now I have an exception that looks very similar to the one present in the JIRA issued MODE-879, with a slight difference.
Basically I tried to add a node to the root node and save the session, this is the exception I got:
Exception in thread "main" org.modeshape.graph.property.PathNotFoundException: Unable to find "/{http://www.jcp.org/jcr/1.0}system[2]"; lowest existing path is "/" at org.modeshape.connector.jcr.JcrRequestProcessor$Workspace.node(JcrRequestProcessor.java:893) at org.modeshape.connector.jcr.JcrRequestProcessor.process(JcrRequestProcessor.java:356) at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:288) at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:354) at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:229) at org.modeshape.connector.jcr.JcrRepositoryConnection.execute(JcrRepositoryConnection.java:119) at org.modeshape.graph.connector.RepositoryConnectionPool$ConnectionWrapper.execute(RepositoryConnectionPool.java:1129) at org.modeshape.graph.request.CompositeRequestChannel$2.call(CompositeRequestChannel.java:193) at org.modeshape.graph.request.CompositeRequestChannel$2.call(CompositeRequestChannel.java:183) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680)
This is the code I'm testing:
logger.info("Starting tests"); try { JcrRepository repository = engine.getRepository("test"); logger.info("Got repository test"); Session session = repository.login(); logger.info("Got valid session"); Node rootNode = session.getRootNode(); logger.info("Got root node: " + rootNode); Workspace workspace = session.getWorkspace(); logger.info("Current workspace: " + workspace.getName()); rootNode.addNode("myNode","nt:unstructured"); session.save(); logger.info("Added node myNode to root node"); session.logout(); logger.info("Logged out"); } catch (RepositoryException e) { e.printStackTrace(); }
And this is the output:
777 [main] INFO com.sourcesense.stone.extensions.it.Modeshape2JackrabbitConnectorIT - Starting tests 1083 [main] INFO com.sourcesense.stone.extensions.RepositoryFactory - Creating repository from url: http://localhost:8080/server 1314 [main] INFO com.sourcesense.stone.extensions.CredentialsFactory - Creating credentials with username: admin, password: admin 1315 [main] INFO com.sourcesense.stone.extensions.RepositoryConnectionFactory - Creating a repository connection 30340 [main] INFO com.sourcesense.stone.extensions.it.Modeshape2JackrabbitConnectorIT - Got repository test 30503 [main] INFO com.sourcesense.stone.extensions.it.Modeshape2JackrabbitConnectorIT - Got valid session 30557 [main] INFO com.sourcesense.stone.extensions.it.Modeshape2JackrabbitConnectorIT - Got root node: / {jcr:primaryType=rep:root, jcr:mixinTypes=[rep:AccessControllable], } 30557 [main] INFO com.sourcesense.stone.extensions.it.Modeshape2JackrabbitConnectorIT - Current workspace: default Exception in thread "main" org.modeshape.graph.property.PathNotFoundException: Unable to find "/{http://www.jcp.org/jcr/1.0}system[2]"; lowest existing path is "/" ...
While debugging, I reached the org.modeshape.jcr.SessionCache class, and I think I discovered something interesting:
The content of the graphSession field is the following:
{1=Cached node <1> at { / }, 2=Cached node <2> at { /{httpwww.jcp.orgjcr1.0}system }, 3=Cached node <3> at { /{internal}policy }, 4=Cached node <4> at { /{httpwww.jcp.orgjcr1.0}system[2] }, 5=Cached node <5> at { /{}myNode }}
Please note the encoding of ':' and of '/'; is that the problem that cause a mismatch when searching item by key in this map?
What do you thing?
Thanks a lot
Ale
Message was edited by: Alessandro Novarini, I added other - hopefully - usefull information to understand what's happening