0 Replies Latest reply on Apr 29, 2013 10:06 AM by rahul22

    Seam Solder 3.1.1.Final + richfaces 4 fileuploader + Attempted to inject an HttpServletRequest before it has been initialized

    rahul22

      Hi,

       

      VERSIONS :


           1. Richfaces 4

           2. Seam solder 3.1.1Final

           3. Jboss 7.1

       

      EXPLAINATION :

       

      Actually I'm migrating from richfaces 3 to richfaces 4.

       

      I have a xhtml in which I'm using richfaces 4.x fileuploader tag .

      and i have defined listener in a class with conversation scope and I'm Not enjecting Request any where in my class.

       

      TAG IN XHTML


      <rich:fileUpload id="xxx" uploadControlLabel="xxx"

                              fileUploadListener="#{xxx}"

                              maxFilesQuantity="10" immediateUpload="false" acceptedTypes="xls"

                              allowFlash="#{xxx}"

                              style="width:100%;" onerror="alert('err')" autoclear="false"

                              onadd="xxx"

      >

       

      now when i'm clicking on upload i'm getting below EXCEPTION:

       

      {code}19:25:35,384 INFO  [com.xxx.seam.exception.xxx] (http-localhost-127.0.0.1-8080-2) Global Exception handler caught: xxx.xhtml @170,26 fileUploadListener="#{xxx}": java.lang.IllegalStateException: Attempted to inject an HttpServletRequest before it has been initialized

          at org.richfaces.event.MethodExpressionEventListener.processEvent(MethodExpressionEventListener.java:137) [richfaces-components-ui-4.2.3.Final.jar:4.2.3.Final]

          at org.richfaces.view.facelets.FileUploadHandler$FileUploadListenerImpl.processFileUpload(FileUploadHandler.java:55) [richfaces-components-ui-4.2.3.Final.jar:4.2.3.Final]

          at org.richfaces.event.FileUploadEvent.processListener(FileUploadEvent.java:48) [richfaces-components-api-4.2.3.Final.jar:4.2.3.Final]

          at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:759) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

       

      Caused by: java.lang.IllegalStateException: Attempted to inject an HttpServletRequest before it has been initialized.

          at org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest(ImplicitHttpServletObjectsProducer.java:73) [solder-impl-3.1.1.Final.jar:3.1.1.Final]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0]{code}

       

      MY FINDINGS :


      i found https://issues.jboss.org/browse/SOLDER-311 where they asked to add following filter:

       

      {code}<filter>

                  <filter-name>Seam 3.1 Servlet Filter</filter-name>

                  <filter-class>org.jboss.solder.servlet.event.ServletEventBridgeFilter</filter-class>

          </filter>

       

          <filter-mapping>

                  <filter-name>Seam 3.1 Servlet Filter</filter-name>

                  <url-pattern>/*</url-pattern>

         </filter-mapping>{code}

       

      but after adding this I'm gettig NullPointerException , which is mentioned in the thread itself and you can find it there.

       

      I'm not able to find any solution for this.

      Even I'm Not clear about the root cause of the Exception.

       

       

      I'm able to call other methods of some other class but not from this class.

       

      any help will be great !!!

      plz help ...

       

      Thanks