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

NullPointerException during Repository.login in EJB Startup

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 3.0.0.Alpha5
    • 3.0.0.Alpha4
    • None
    • None

    Description

      The Repository.login is working fine for the REST client, but within a @javax.ejb.Singleton bean, the login could not be performed. A NullPointerException is thrown during the initialization of RepositoryCache (L:135). I tried to initialize the repository within a @PostConstruct method.

      I debugged the code a little bit: Triggered by the REST client (RepositoryManager of example) we have the following (working) scenario in class RepositoryCache (constructor):

      • Line 119: Get root node (1.) of system workspace
      • root node's child reference is null, so a new one is created and saved at line 128
      • the root node's child reference (2.) is looked up again at line 130
      • root node (1.) and root node (2.) are different object references
      • the systemRef in line 131 is resolved to a valid ChildReference
      • -> the repository session is created

      Triggered by the @javax.ejb.Singleton bean (@PostConstruct) the scenario in RepositoryCache changes to:

      • Line 119: Get root node (1.) of system workspace
      • root node's child reference is null, so a new one is created and saved at line 128
      • the root node's child reference (2.) is looked up again at line 130
      • root node (1.) and root node (2.) are THE SAME object references
      • the systemRef in line 131 is resolved to null
      • -> a NullPointerException occurs at line 135

      Used in a non-startup bean, the repository can be obtained successfully as described for the REST client. There is a different behavior between Startup and "normal" execution. Might be a transaction problem, regarding to system.save() and re-lookup of root node?

      See forum https://community.jboss.org/message/739667 for the problem thread.

      Attachments

        Issue Links

          Activity

            People

              rhauch Randall Hauch (Inactive)
              cluxig Carsten Luxig (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: