2 Replies Latest reply on Oct 31, 2008 1:29 PM by blabno

    No active application context

    blabno

      I have seam component named manager. It has @Asynchronous method that starts a loop and creates several threads that download some information and then they return result to manager that is responsible for persisting it into database.
      The problem is that sometimes this works and sometimes i get :


      Exception in thread "Thread-251"
      java.lang.IllegalStateException: No active application context
      org.jboss.seam.security.permission.PermissionManager.instance(PermissionManager.java:62)
      org.jboss.seam.persistence.EntityManagerProxy.remove(EntityManagerProxy.java:148)
      org.Manager.acceptPool(Manager.java:178)
      org.Worker.run(Worker.java:102)
      



      Manager.java:178 :


      em.remove(persistedPool);



      What is the reason for this ?

        • 1. Re: No active application context
          blabno

          Is maybe context dependent on a thread ? Cause em.remove within acceptPool method is executed in Thread-251 and Manager starts in some DefaultQuartzScheduler_Worker-1,5,jboss.

          • 2. Re: No active application context
            blabno

            First tests seem to confirm this suspicion. Now my acceptPool method does not call entity manager nor other injected stuff. It just adds result to collection that will be processed in looping method fired in DefaultQuartzScheduler_Worker thread which is set up by @Asynchronous annotation.