1 Reply Latest reply on Aug 13, 2007 4:42 PM by Reind D

    Seam without JSF + Servlet

    Reind D Newbie

      My application is deployed as an EAR with multiple webapps. One of the webapps has a single servlet within which I'd like to use a Seam component. Seam works on the other JSF webapp in the same ear, but I can't get it to work on the servlet.

      I've added a context-filter for the same url-pattern as the servlet uses (as described in the Seam docs):

      components.xml

      <web:context-filter url-pattern="/request/*" />


      web.xml
      <servlet-mapping>
       <servlet-name>Controller</servlet-name>
       <url-pattern>/request/*</url-pattern>
       </servlet-mapping>


      The seam components that are in the jar are getting picked up by the ComponentScanner but when I try to inject or use Components.getIntance(...), I get:

      java.lang.IllegalStateException: No application context active
       org.jboss.seam.Component.forName(Component.java:1577)
       org.jboss.seam.Component.getInstance(Component.java:1627)
       org.jboss.seam.Component.getInstance(Component.java:1610)
       org.jboss.seam.Component.getInstance(Component.java:1604)


      but I do have the listener configured in web.xml
      <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>


      Any ideas?




        • 1. Re: Seam without JSF + Servlet
          Reind D Newbie

          Needed the Seam Filter in web.xml...

           <filter>
           <filter-name>Seam Filter</filter-name>
           <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
           </filter>
           <filter-mapping>
           <filter-name>Seam Filter</filter-name>
           <url-pattern>/request/*</url-pattern>
           </filter-mapping>


          Works now.