3 Replies Latest reply on Aug 15, 2012 3:45 PM by Werner Gaulke

    Problem with Seam 3 application and RestEasy - FacesContext is not active

    Werner Gaulke Newbie



      i am facing a problem which is stressing me, maybe someone can help me out.


      I want to add a REST interface to a running Seam 3 Web application. Implementing GET methods was easy until I wanted to use @Inject in the REST Interface, for example:




      public class RestApi extends Application{





      public class UserApi {



          private PojoBean beant;




          public String test(){




              return "test";






      Without the bean.doSomething() the service works fine, but as soon as I try to use the bean I get the exception:


      javax.enterprise.context.ContextNotActiveException: FacesContext is not active

          at org.jboss.seam.faces.environment.FacesContextProducer.getFacesContext(FacesContextProducer.java:53) [seam-faces-3.1.0.Final.jar:3.1.0.Final]




      What I tried:

      • RequestScope to API
      • Adding Faces Servlet to the API path :<url-pattern>/api/*</url-pattern>
      • Adding seam-rest module



      My configuration


      • JBoss AS 7.1.1
      • Seam 3.1 (Faces Module, Solder, Persistence and Security)




      Am I missing something? Any clues are appreciated!