javajsficefacesjsf-1.2icefaces-1.8

javax.servlet.ServletException: ICEfaces requires the PersistentFacesServlet


I am a beginner in ICEFACES, trying to run my first ICEFACES screen successfully using some ICEFACES components. To get started with. I am using ICEFACES 1.8.2.

I copied the content of my web.xml from this link:

http://res.icesoft.org/docs/v1_8_2/htmlguide/gettingstarted/SessionRendererTutorial11.html#1054095

Below is the faces-config.xml file:

<faces-config
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-facesconfig_1_2.xsd"
version="1.2">
<application>
    <view-handler> 
    com.icesoft.faces.facelets.D2DFaceletViewHandler 
    </view-handler>
</application>
</faces-config>

Below is the Test.jsp screen content:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="ice"  uri="http://www.icesoft.com/icefaces/component"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
    <ice:outputText id="txtHello" value="Hello ICEFaces"></ice:outputText> <br> 
    <ice:panelGroup title="Hello"></ice:panelGroup>
</f:view>
</body>
</html>

When I run the app using the below URL:

http://localhost:8046/TestMojarra/faces/Test.jsp

I am getting an exception:

javax.servlet.ServletException: ICEfaces requires the PersistentFacesServlet. Please check your web.xml servlet mappings javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)

java.lang.IllegalStateException: ICEfaces requires the PersistentFacesServlet. Please check your web.xml servlet mappings com.icesoft.faces.context.DOMResponseWriter.<init>(DOMResponseWriter.java:154) com.icesoft.faces.context.DOMContext.createTemporaryDOMResponseWriter(DOMContext.java:182) com.icesoft.faces.context.DOMContext.getDOMContext(DOMContext.java:228) com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:89) javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840) javax.faces.component.UIComponent.encodeAll(UIComponent.java:930) javax.faces.component.UIComponent.encodeAll(UIComponent.java:933) com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266) com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197) com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:151) com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:151) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

But if I comment out the <ice:panelGroup> line from the above jsp file, the screen is getting displayed.

Kindly let me know where is the issue.


Solution

  • This is all I ever did in my web.xml. I had the servlet declarations

    <servlet>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>Blocking Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    

    And the the mappings to the servlets

    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>/ifaces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>/xmlhttp/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Blocking Servlet</servlet-name>
        <url-pattern>/block/*</url-pattern>
    </servlet-mapping>
    

    I always used xhtml files, though, and not jsp files. But, this always worked for me.

    EDIT I've re-edited your sample into xhtml format. There were two tags which weren't valid xhtml. But this is what typically worked for me

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ice="http://www.icesoft.com/icefaces/component"
          xmlns:f="http://java.sun.com/jsf/core">
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
        <title>Insert title here</title>
      </head>
      <body>
        <f:view>
          <ice:outputText id="txtHello" value="Hello ICEFaces"></ice:outputText> <br/> 
          <ice:panelGroup title="Hello"></ice:panelGroup>
        </f:view>
      </body>
    </html>