4 Replies Latest reply on Oct 10, 2008 2:26 PM by Stephan B

    No process context active

    Stephan B Newbie

      Hi,


      for quite some time I'm trying now to automatically setup a few jBPM processes after startup (for testing purposes). My observer


      @Transactional
      @Observer("org.jboss.seam.postInitialization")
      public void init() {
        ...
        Contexts.getEventContext().set("newApplication", app);
        applicationAction.apply();
      }
      


      works fine. The apply() looks like that:



      @End
      @CreateProcess(definition = "apply", processKey = "#{newApplication.id}")
      public String apply() {
        ...
        Contexts.getBusinessProcessContext().set("applicationId", applicationId);
      }
      


      This, however, results in a NullPointerException. When I try to use @Out alternatively it prints the message No process context active.


      But how/when is it started?


      PS: Invoking the apply() method via a command button works simply fine.

        • 1. Re: No process context active
          Stephan B Newbie

          In case the stack trace is of interest (using Tomcat without JBoss Embedded and Seam 2.1.0-Snapshot):



          SEVERE: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
          java.lang.NullPointerException
               at com.action.TrainerApplicationAction.apply(TrainerApplicationAction.java:114)
               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:585)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
          ...


          • 3. Re: No process context active
            Stephan B Newbie

            In case somebody runs into the same problem, simply call


            ManagedJbpmContext.instance()



            This will initialize the context.

            • 4. Re: No process context active
              Stephan B Newbie

              false alarm, still fighting with this one :-(