-
Bug
-
Resolution: Done
-
Major
-
2.7.0.Final
-
None
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):
- Create/configure the engine (only once)
- Login and get a session
- Try to find the node
- Logout from the session
The code pretty much looks like (no custom CND is being used):
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.
The stack trace is:
java.lang.NullPointerException at org.modeshape.jcr.JcrNodeDefinition.ensureRequiredPrimaryTypesLoaded(JcrNodeDefinition.java:121) at org.modeshape.jcr.JcrNodeDefinition.allowsChildWithType(JcrNodeDefinition.java:249) at org.modeshape.jcr.RepositoryNodeTypeManager.findChildNodeDefinition(RepositoryNodeTypeManager.java:1142) at org.modeshape.jcr.RepositoryNodeTypeManager.findChildNodeDefinition(RepositoryNodeTypeManager.java:1161) 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.findNodeRelativeTo(GraphSession.java:535) at org.modeshape.graph.session.GraphSession.findNodeWith(GraphSession.java:398) at org.modeshape.graph.session.GraphSession.findNodeWith(GraphSession.java:381) at org.modeshape.jcr.SessionCache.findNode(SessionCache.java:532) at org.modeshape.jcr.SessionCache.findJcrNode(SessionCache.java:643) at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:838) at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:703) at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:96) at com.acme.contents.ModeshapeManagerBean.findNode(ModeshapeManagerBean.java:67) at com.acme.contents.ModeshapeManagerBean.findNode(ModeshapeManagerBean.java:50) at com.acme.views.ResourceController.getStream(ResourceController.java:69) at comacme.views.ResourceController.handleResource(ResourceController.java:46) 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) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:6