5 Replies Latest reply on Feb 27, 2007 5:56 PM by apushadow

    No active application scope in long running process

      Posted to JBPM forum but was directed to ask the question here...

      I have a long running business process defined in JBPM and I am facing a stubborn problem: when my process "awakens" after some period of time spent in a wait state (I use a timer to wait), I get a "No active application scope" exception when JBPM executes the next node (which contains a simple expression).

      My exception occurs on the following node:

      <decision name="isARAvailable" expression="#{ARChecker.isARAvailable}">
       <transition name="false" to="waitForAR"></transition>
       <transition name="true" to="end"></transition>
      </decision>
      


      The ARChecker component is defined as as stateful EJB:

      @Stateful
      @Scope(ScopeType.BUSINESS_PROCESS)
      @Name("ARChecker")
      public class ARCheckerBean implements ARChecker {
      ...
      
      
      public String isARAvailable()
      {
      ...
      }
      ...
      
      


      What am I missing?

        • 1. Re: No active application scope in long running process
          gavin.king

          Seam does not currently support jBPM timers or async nodes. This is a future roadmap item.

          • 2. Re: No active application scope in long running process
            pmuir

            I'm about to hit this limitation. I guess http://jira.jboss.com/jira/browse/JBSEAM-161 is the issue.

            Is this work in progress or has it not yet been started? Any suggestions about where to start on it?

            • 3. Re: No active application scope in long running process

              If seam does not support async transactions, jBPM does... cant we just use the jBPM features instead once the process definition is kicked off from @CreateProcess?

              • 4. Re: No active application scope in long running process
                gavin.king

                Sure, you just won't be able to use all Seam functionality from the asyn thread.

                • 5. Re: No active application scope in long running process

                  Ahh, ok. This answers a lot of my questions. I'm looking forward to a solution to this problem.

                  I use Seam 1.1.6 with Tomcat and Embedded EJB. I'm trying to prototype being able to run a method at a specified time - the method must (1) send an email, (2) update the database and (3) raise an event so that some @Observer methods get called to refresh collections of objects shown on-screen - and I've had mixed results:

                  --Using the @Asynchronous annotation doesn't work at all using the Embedded EJB stuff.
                  --Integrating Quartz with Seam (add quartz.jar and quartz.properties and it magically works) and kicking off a task at a specific time works, but I can't use a lot of Seam's cool functionality in that new thread - namely Emailing, which throws a NPE (JBSEAM-892), and Events, which gives me a "No active application scope" error. Updating the database works (since I passed-in a reference to my persister bean), but I have to use JavaMail to send emails (passing-in the Email Renderer isn't sufficient) and I can no longer rely on the @Observer annotation to update the lists (I'm still working on an alternative).

                  Ideally (and this is easy for me to say, heh), it would be cool to be able to use Seam's scheduling, emailing and event system, regardless of what thread I'm running (or perhaps provide a way to reference those contexts?), but I know this is no easy task.