webtier@glassfish.java.net

Very simple JSF page throwing an exception

From: <webtier_at_javadesktop.org>
Date: Fri, 31 Jul 2009 11:10:34 PDT

Hello,

I'm trying to reproduce the numberGuess 2.0 example (located in mojarra svn: trunk/jsf-demo/numberGuess2.0). I'm using Mojarra 2.0.0-b14 on Glassfish v3 Preview. I set up a very simple page with one outputText element to test if JSF is working. When attempting to view the page, JSF throws an exception and an unmodified template page including JSF tags is sent to the browser. Compiling the official numberGuess2.0 example and deploying the war works flawlessly, so the problem probably isn't Glassfish settings, it is likely my misunderstanding and ignorance :)

Could someone please tell me what I am doing wrong? I will post contents of index.xhtml, web.xml and the exception trace. (Note: I am viewing the page using url http://localhost:8080/NumberGuess/guess/)

Thanks
Jiri Stransky

---- index.xhtml ----
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Example</title>
    </h:head>
    <h:body>
        Hello <h:outputText value="World"/>!
    </h:body>
</html>

---- web.xml ----
<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">

    <display-name>
        NumberGuess
    </display-name>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/guess/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
</web-app>

---- Exception Trace ----
[#|2009-07-31T16:48:17.138+0200|SEVERE|glassfish|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=18;_ThreadName=Thread-1;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: PWC1227: Cannot forward after response has been committed
        at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:389)
        at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:367)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:315)
        at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:530)
        at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:330)
        at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:129)
        at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:164)
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1506)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:293)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:351)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:250)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:202)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:746)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:161)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)
|#]
[Message sent by forum member 'jistr' (jistr)]

http://forums.java.net/jive/thread.jspa?messageID=358401