1 Reply Latest reply on Jul 18, 2013 2:19 PM by sudda_1

    JSF 1.2 and JBoss 7.2 issue: Illegal attempt to set ViewHandler after a response has been rendered

    sudda_1 Newbie

      I'm porting an application from JBoss_5_1_0_GA  to JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8)

      I did not run into the following issue in JBoss 5.1.0

       

      The below error occurs when accessing any JSF page on JBoss 7.2.0


       

      I'm using JSF 1.2  + RichFaces 3.3.3 + OpenFaces on JBoss 7.2.0(EAP 6.1)

       

       

      HTTP Status 500 - javax.servlet.ServletException: Illegal attempt to set ViewHandler after a response has been rendered


      javax.servlet.ServletException: javax.servlet.ServletException: Illegal attempt to set ViewHandler after a response has been rendered.

      org.openfaces.util.ResourceFilter.doFilter(ResourceFilter.java:130)

      org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)

       

       

       

      JBWEB000071: root cause

      javax.servlet.ServletException: Illegal attempt to set ViewHandler after a response has been rendered.
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
           org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:286)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
           org.openfaces.util.ResourceFilter.doFilter(ResourceFilter.java:99)
           org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)

       

      JBWEB000071: root cause

      java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.

      com.sun.faces.application.ApplicationImpl.setViewHandler(ApplicationImpl.java:563)

      org.openfaces.application.OpenFacesApplication.setViewHandler(OpenFacesApplication.java:145)

      org.ajax4jsf.event.InitPhaseListener.beforePhase(InitPhaseListener.java:92)

      com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)

      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)

      com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)

      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

      javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

      org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:286)

      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

      org.openfaces.util.ResourceFilter.doFilter(ResourceFilter.java:99)

      org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)

       

       

       

      I'm getting the above error when accessing any JSF page.

       

       



      <dependency>



      <groupId>javax.faces</groupId>



      <artifactId>jsf-impl</artifactId>



      <version>1.2_04</version>



      <scope>provided</scope>


      </dependency>


      <dependency>



      <groupId>javax.faces</groupId>



      <artifactId>jsf-api</artifactId>



      <version>1.2_04</version>



      <scope>provided</scope>


      </dependency>

       

       



      <dependency>



      <groupId>jsf-facelets</groupId>



      <artifactId>jsf-facelets</artifactId>



      <version>3.3.3</version>



      <systemPath>${basedir}/WebContent/WEB-INF/lib/jsf-facelets.jar</systemPath>



      <scope>system</scope>


      </dependency>


      <dependency>



      <groupId>richfaces-api</groupId>



      <artifactId>richfaces-api</artifactId>



      <version>3.3.3</version>



      <systemPath>${basedir}/WebContent/WEB-INF/lib/richfaces-api-3.3.3.Final.jar</systemPath>



      <scope>system</scope>


      </dependency>




      <dependency>



      <groupId>richfaces-impl</groupId>



      <artifactId>richfaces-impl</artifactId>



      <version>3.3.3</version>



      <systemPath>${basedir}/WebContent/WEB-INF/lib/richfaces-impl-3.3.3.Final.jar</systemPath>



      <scope>system</scope>


      </dependency>


      <dependency>



      <groupId>richfaces-ui</groupId>



      <artifactId>richfaces-ui</artifactId>



      <version>3.3.3</version>



      <systemPath>${basedir}/WebContent/WEB-INF/lib/richfaces-ui-3.3.3.Final.jar</systemPath>



      <scope>system</scope>


      </dependency>

       

       

      How do I fix the ViewHandler error on JBoss 7.2 ?

        • 1. Re: JSF 1.2 and JBoss 7.2 issue: Illegal attempt to set ViewHandler after a response has been rendered
          sudda_1 Newbie

          I found the solution to my issue. Posting it here so it may be beneficial for others also.

           

          By default, JBoss7 uses the 2.0 JSF implementation.  However old JSF 1.2 based libraries like openfaces have issues running within JSF2.0 environment. Need to force the app server to load JSF1.2 environment.

          To have it use the JBoss 1.2 implementation, you need to add the following context parameter to your web.xml:

          <context-param>

                <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>

                <param-value>Mojarra-1.2</param-value>

           

          </context-param>

          This fixed the problem.