File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Cannot create a session after the response has been committed - JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Cannot create a session after the response has been committed - JSF " Watch "Cannot create a session after the response has been committed - JSF " New topic
Author

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

loges radhakrishnan
Greenhorn

Joined: Jun 27, 2012
Posts: 2
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
Cesar Alforde
Greenhorn

Joined: Feb 21, 2009
Posts: 3

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.

loges radhakrishnan
Greenhorn

Joined: Jun 27, 2012
Posts: 2
Even after removing that line it doesnt work.

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

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

The JSP form of View Definition is obsolete in JSF2, so all those JSP-specific items are probably being mis-applied.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot create a session after the response has been committed - JSF