Question

I am working on a "resource" controller using the latest Spring3 and JBoss Modeshape (pointing to a federated repository using the Filesystem connectors) to retrieve an asset.

When I access any webpage, using the controller, it returns most of the images then throws a NullPointerException in the "getNode" call at various other ones...

On my end, I am not doing anything special (my test cases work fine):

  1. Create/configure the engine (only once)
  2. Login and get a session
  3. Try to find the node
  4. Logout from the session

The code pretty much looks like:

session = createSession();
Node node = session.getNode(path);

After the first hit to the page (with errors), every hit after that works perfect and everything loads fine from then out.

I am following this link Heavy Concurrency: A better way to manage JCR Sessions for the session creation/management.

It appears as if I have multiple threads trying to configure the JcrNodeDefinition in Modeshape. If i mark the enureRequirePrimaryTypesLoaded() method as synchronized then I do not get the error ever.

Anyone have any experience/suggestions with using Modeshape, concurrency, and session management?

The stack trace is:

java.lang.NullPointerException at org.modeshape.jcr.JcrNodeDefinition.ensureRequiredPrimaryTypesLoaded(JcrNodeDefinition.java:114) at org.modeshape.jcr.JcrNodeDefinition.allowsChildWithType(JcrNodeDefinition.java:275) at org.modeshape.jcr.RepositoryNodeTypeManager.findChildNodeDefinition(RepositoryNodeTypeManager.java:1142) at org.modeshape.jcr.JcrNodeTypeManager.findChildNodeDefinition(JcrNodeTypeManager.java:433) at org.modeshape.jcr.SessionCache$JcrNodeOperations.materialize(SessionCache.java:2711) at org.modeshape.graph.session.GraphSession$Node.load(GraphSession.java:1755) at org.modeshape.graph.session.GraphSession$Node.getPayload(GraphSession.java:3030) at org.modeshape.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:950) at org.modeshape.jcr.AbstractJcrNode.getNode(AbstractJcrNode.java:96) at com.acme.beans.contents.FileNodeAdapter.(FileNodeAdapter.java:26) at com.acme.web.views.ResourceController.getStream(ResourceController.java:77) at com.acme.web.views.ResourceController.handleResource(ResourceController.java:46)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top