Forums Register Login

Cannot create a session after the response has been committed - JSF

+Pie Number of slices to send: Send
Hi,

I am new to this JSF and i just tried a simple HelloWorld example in my local.I have the javax.faces-api-2.1.jar and i using the Tomcat 7 server.When i run my app the server is throwing the following error

SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/JSFHelloWorld] threw exception [Cannot create a session after the response has been committed] with root cause
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2725)
at org.apache.catalina.connector.Request.getSession(Request.java:2235)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:899)
at org.apache.myfaces.context.servlet.SessionMap.setAttribute(SessionMap.java:56)
at org.apache.myfaces.util.AbstractThreadSafeAttributeMap.put(AbstractThreadSafeAttributeMap.java:109)
at org.apache.myfaces.util.AbstractThreadSafeAttributeMap.put(AbstractThreadSafeAttributeMap.java:38)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedViewInServletSession(JspStateManagerImpl.java:697)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:497)
at javax.faces.application.StateManager.saveView(StateManager.java:114)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveView(JspStateManagerImpl.java:460)
at org.apache.myfaces.shared_impl.view.JspViewDeclarationLanguageBase.renderView(JspViewDeclarationLanguageBase.java:197)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:263)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

and my code is



I tried increasing the jsp response buffer size and it doesnt solve the problem

Help me through this .

Thanks in advance
+Pie Number of slices to send: Send
I think you should not include this

but follow the Oracle Java JSF tutorial http://docs.oracle.com/javaee/6/tutorial/doc/gjaam.html
for the correct way to write JSF pages.

+Pie Number of slices to send: Send
Even after removing that line it doesnt work.

Anyways i tried the sample which you suggest and it worked fine.

Thanks
+Pie Number of slices to send: Send
The JSP form of View Definition is obsolete in JSF2, so all those JSP-specific items are probably being mis-applied.
Die Fledermaus does not fear such a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 5678 times.
Similar Threads
tomcat cannot display jsp struts
JSF Property not found
Cannot create a session after the response has been committed
Crate chart using jsf
How to display popup in JSF
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:31:05.