Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1374

ensureRequiredPrimaryTypesLoaded throwing NullPointerException on first access under Jetty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.8.0.Final, 3.0.0.Alpha1
    • 2.7.0.Final
    • JCR
    • 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):

      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 (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
      

              rhauch Randall Hauch (Inactive)
              kjq_jira KimJohn Quinn (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: