4 Replies Latest reply on Jul 28, 2010 1:40 AM by Michael Wohlfart

    [Q] JBPM 4.4 JbpmException

    Ken Hoying Newbie

      I am trying to use the new JBPM 4.4 API to get the tranistions that are valid for the current process based on the processes current status.  However, I must be doing something wrong or must not understand something correctly.  Any help from the more knowledgeable would be greatly appreciated.


      I have tried the following:




      However, it get the following exception:


      Caused by: org.jbpm.api.JbpmException: no environment to get org.jbpm.pvm.internal.session.RepositorySession
          at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:203)
          at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:196)
          at org.jbpm.pvm.internal.model.ExecutionImpl.getProcessDefinition(ExecutionImpl.java:1182)
          at org.jbpm.pvm.internal.model.ExecutionImpl.getActivity(ExecutionImpl.java:1203)
          at org.jbpm.pvm.internal.model.ExecutionImpl.getActivity(ExecutionImpl.java:86)


      I have also attempted to get the the list of executions and process them.  However, the list is always empty.


      I am obviously missing something here with my understanding of the API.  Can someone enlighten me or point me in the right direction?


      Thank you!

        • 1. Re: [Q] JBPM 4.4 JbpmException
          Michael Wohlfart Expert

          The problem is there is a database session needed if you call some of the methods, especially on the persistent objects like task, execution, process etc.... that's just the nature of mapping objects to a database, it is not a bug...


          you can:

          • stick with the methods of the services (RepositoryService, IdentityService, etc)
          • open/close an environment that manages the session for you (see developers guide section 6.5):
            EnvironmentImpl environment = (EnvironmentImpl) ((EnvironmentFactory)processEngine).openEnvironment();
            try {
              // do your stuff here
            } finally {
          • create a command that is executed by the process engine (see developers guide section 6.6):
            processEngine.execute(new Command() {
              public Object execute(Environment env) {
                // do your stuff here
                return null;
          • 2. Re: [Q] JBPM 4.4 JbpmException
            Ken Hoying Newbie

            Thank you so much for your assistance.  This was terrific and very helpful!


            Have a great week!

            • 3. Re: [Q] JBPM 4.4 JbpmException
              derek lee Newbie

              hello ,wohlfart:


                 i read the three points that you given. it's indeed helpful. but i have some trouble with the point 1,"stick with the methods of the services (RepositoryService, IdentityService, etc)". could you give an example or something? Thanks

              • 4. Re: [Q] JBPM 4.4 JbpmException
                Michael Wohlfart Expert

                hi derek,

                for example using the taskService to get some subtasks like


                instead of task.getSubTask() when there is no hibernate session around.