11 Replies Latest reply on Sep 28, 2009 4:34 AM by krohm

    NullPointerException using identityService

    cjmanju123

      I am getting NullPointerException when trying to do anything using the identityservcie. following is the test code. i can create process, assign tasks but when i try any method on the identityservice it throws NullPointerException. Please help.

      Configuration configuration = JBPMSingleton.getConfig();
      ProcessEngine processEngine = configuration.buildProcessEngine();
      IdentityService identityService = processEngine.getIdentityService();

      String group = identityService.createGroup("test");
      identityService.createUser("jason", "jason", "king");
      identityService.createMembership("alex", group, "developer");
      int i = identityService.findUsers().size();
      System.out.println("no of users " + i);

      Thanks
      Manju

        • 1. Re: NullPointerException using identityService
          kukeltje

          Most likely your config is not correct and the identityService is null because processEngine.getIdentityService() returns null;

          have you tested that?)

          • 2. Re: NullPointerException using identityService
            cjmanju123

            No identiyServcie is not null. With the same configuration I am able to do everything else (like starting a process, assigning task, etc.,) By the way the version of jBPM is 4.0. and here is the exception

            Exception in thread "main" java.lang.NullPointerException
             at org.jbpm.pvm.internal.identity.cmd.CreateGroupCmd.execute(CreateGroupCmd.java:48)
             at org.jbpm.pvm.internal.identity.cmd.CreateGroupCmd.execute(CreateGroupCmd.java:32)
             at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
             at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
             at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
             at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
             at org.jbpm.pvm.internal.svc.IdentityServiceImpl.createGroup(IdentityServiceImpl.java:78)


            Thanks
            Manju

            • 3. Re: NullPointerException using identityService
              kukeltje

              cool... next time, please post this directly... do you have turned the log level to debug and checked if that shows more? Have you tried debugging in your IDE? Have you checked what the line effectively does? (the source is open).

              Sorry to not give you a direct answer, but that is mainly because I can't with what you posted.

              • 4. Re: NullPointerException using identityService
                cjmanju123

                Actually it is a configuration issue. I had removed the following from my jbpm.cfg.xml file.



                Thanks
                Manju

                • 5. Re: NullPointerException using identityService
                  kukeltje

                  Thanks for reporting back. Can you post again within [c o d e] [/c o d e] tags (no spaces)

                  • 6. Re: NullPointerException using identityService
                    cjmanju123

                    Sorry here it is again, I had removed the following entry from the jbpm.cfg.xml.

                    <import resource="jbpm.identity.cfg.xml" />


                    Error gives no clue to the actual issue. I noticed that the default configuration file jbpm.default.cfg.xml in the jbpm4.jar only adds the hibernate configuration.

                    Thanks
                    Manju

                    • 7. Re: NullPointerException using identityService
                      jbarrez

                      Which is logical, since not every one is using the identityService (so the default import does not include it)

                      • 8. Re: NullPointerException using identityService
                        kukeltje

                        Might be something for a section in the userguide

                        • 9. Re: NullPointerException using identityService

                           

                          "cjmanju123" wrote:
                          Sorry here it is again, I had removed the following entry from the jbpm.cfg.xml.

                          <import resource="jbpm.identity.cfg.xml" />


                          I have the same error when trying to create Users / Groups through the IdentityService in JBPM 4.1 :

                          java.lang.NullPointerException
                           at org.jbpm.pvm.internal.identity.cmd.CreateGroupCmd.execute(CreateGroupCmd.java:48)
                           at org.jbpm.pvm.internal.identity.cmd.CreateGroupCmd.execute(CreateGroupCmd.java:32)
                           at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                           at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
                           at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
                           at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                           at org.jbpm.pvm.internal.svc.IdentityServiceImpl.createGroup(IdentityServiceImpl.java:70)


                          I have investigated it a bit, and it seems some classes are somehow "Missing" in the JBPM4.1 I am working with.

                          These classes are (from what I have tried from now) :
                          org.jbpm.pvm.internal.identity.cmd.CreateGroupCmd
                          org.jbpm.pvm.internal.identity.cmd.CreateUserCmd

                          I was expecting it to be with the other classes of the same package and downloadable with the following maven dependency :

                          <dependency>
                           <groupId>org.jbpm.jbpm4</groupId>
                           <artifactId>jbpm-pvm</artifactId>
                           <version>4.0</version>
                          </dependency>


                          Do I have missed something ?


                          • 10. Re: NullPointerException using identityService

                            please read 4.1 in the dependency rather than 4.0

                            • 11. Re: NullPointerException using identityService

                              Hum.

                              Should have red the topic twice before deciding it was not containing the solution of my problem.

                              Sorry.

                              Damn Mondays ...