Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletException : Response has already been committed  RSS feed

 
Grishma Dube
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
While inserting data into 2 tables, I am getting the following error:-
Error: 500
Location: /silicon/jsp/PostCreateUser.jsp
Internal Servlet Error:
java.lang.IllegalStateException: Response has already been committed
at org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:157)
at org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:558)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:564)
at ngasi.connector.tomcat.TomcatConnectionHandler.handleConnection(Unknown Source)
at ezj.b.e.run(Unknown Source)
Pls help me
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A little more info would be helpful but,
This excpetion occurs when:
1) you try to manipulate any of the HTTP header attributes after you have sent something to the client.
2) you try to forward the request after something is sent to the client.
Remember, ther is only one http header sent to the client and it is the first part of the data sent.
 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This will occur when u try to process the html part ,after redirecting the jsp using response.sendRedirect...
try keeping a 'return' after the redirect statement..
ex: response.sendRedirect("");
return;
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's 10 days later, but I think it's more likely that it's due to an Exception being thrown in the JSP after the buffer has filled, and the server being unable to forward to the error page.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!