3 Replies Latest reply on Feb 20, 2010 8:44 PM by Amilio Sanchez

    Componen.getInstance throws java.lang.IllegalStateException: No application context active

    Amilio Sanchez Newbie
      Hello,
      I'm encountering an issue when attempting to lookup Seam components.

      Now I'm sure it is something fundamental to Seam but is their a solution?

      Basically the situation is this:

      I have an ExecutorService to which jobs (which are Seam componts) are submitted for processing, each is required to implement an interface which defines .
      1.) An execution method
      2.) A callback method.

      These are wrapped in a Callable
      Future f = this.executor.submit(new Callable<V>() {
                  public V call() throws Exception {
                      return interface.compute();
                  }
              });

      Upon completion a thread which checks for completion via isDone will call the corresponding jobs callback with the result of the future.

      The problem I'm facing is that the call to the compute method no longer has a context no matter what scope I give the owning Seam component.
      I require a context so that I can in some way (preferably injection) obtain other Seam components which I depend on.

      Is there any way of establishing the context again when another thread invokes a method on it? I have tried various scopes including METHOD but nothing works.

      Thanks