7 Replies Latest reply on Feb 23, 2010 9:31 PM by Amilio Sanchez

    No application context active in java.lang.Thread

    hitec hitec Newbie
      Hi,

      First that's my first application in Seam so my questions will perhaps look weired.
      Here's my problem.

      I'm using Seam on Jboss to implement a web service. When a web service call is done, I would like to use java.lang.Thread to achieve some actions independently of the service call. Once the thread is started, I'm trying to get a seam Component:
      MyComponent myComponent=(MyComponent) Component.getInstance("myComponent");

      At this stage I get the following exception:
      java.lang.IllegalStateException: No application context active

      After verification with Contexts.isApplicationContextActive() the application context is effectively inactive in my thread.

      Some other informations:
      - The seam application is active in my web service method.
      - All my Thread classes are no bean but basic java classes.

      Finally my questions:
      1) Why is the seam application context incactive in my threads if those threads are part of my application?
      2) Is there a way to activate the application context in this thread to be able to get a Component instance?

      Thanks
      J.