Java.lang.IllegalStateException: Invalid attempt to set ViewHandler after receiving response - Jsf1.2 in Weblogic 12c

My current app which works fine on weblogic 11g and uses jsf1.2, richfaces 3.3.1, facelets 1.1.14 gives errors when I run it in Weblogic 12c.

Dependencies for Richfaces, jsf and facelets:

            <dependency>
            <groupId>org.richfaces.framework</groupId>
            <artifactId>richfaces-api</artifactId>
            <version>3.3.1.GA</version>
        </dependency>
        <dependency>
            <groupId>org.richfaces.framework</groupId>
            <artifactId>richfaces-impl</artifactId>
            <version>3.3.1.GA</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-ui</artifactId>
        <version>3.3.1.GA</version>
    </dependency>   
    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>1.2_13</version>
    </dependency>
    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>1.2_13</version>
    </dependency>
    <dependency>
        <groupId>com.sun.facelets</groupId>
         <artifactId>jsf-facelets</artifactId>
        <version>1.1.14</version>
    </dependency>

      

Entries in web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app
  version="2.5"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>
    <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<filter>
    <display-name>Ajax4jsf Filter</display-name>
    <filter-name>ajax4jsf</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    <init-param>
        <param-name>forceparser</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>enable-cache</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>ajax4jsf</filter-name>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<filter-mapping>
    <filter-name>ajax4jsf</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

      

When I deploy my app to Weblogic 12c I get the following error and the page is not displayed.

The error I am getting:

 <Error> <GWS> <BEA-000000> <ERROR 2014-03-14 13:07:06,977 | [ACTIVE]
 ExecuteThread:'5' for queue: 'weblogic.kernel.Default (self-tuning)' | 
BaseXMLFilter:doXmlFilter |LineNumber(199) | Exception in the filter chain
javax.servlet.ServletException: Illegal attempt to set ViewHandler after a response has been rendered.
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
        Truncated. see log file for complete stacktrace
   Caused By: java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.
        at com.sun.faces.application.ApplicationImpl.setViewHandler(ApplicationImpl.java:563)
        at org.ajax4jsf.event.InitPhaseListener.beforePhase(InitPhaseListener.java:92)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
       at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
        Truncated. see log file for complete stacktrace
>

<Mar 14, 2014 1:07:06 PM PDT> <Error> <HTTP> <BEA-101017>
<[ServletContext@3586515[app:gwsexternal-ear-2.5.14 module:/ path:null 
spec-version:3.0], request: weblogic.servlet.internal.ServletRequestImpl@457e6d8e[
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive

]] Root cause of ServletException.
java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.
    at com.sun.faces.application.ApplicationImpl.setViewHandler(ApplicationImpl.java:563)
    at org.ajax4jsf.event.InitPhaseListener.beforePhase(InitPhaseListener.java:92)
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    Truncated. see log file for complete stacktrace
>

      

I have deployed JSF1.2 and JSTL 1.2 as shared libraries in weblogic 12c. But still my application is giving me an error when I try to provide a browser for this page.

How to fix this error for jsf 1.2?

+1


source to share





All Articles