Response already committed

85 views
Skip to first unread message

Roy

unread,
Jun 29, 2006, 2:26:29 PM6/29/06
to Google Web Toolkit
I'm not totally sure this is the right answer but...it works. If I find
anything better I will update this. Especially the matter of what to
set the buffer size too. Such is the life of a work in progress. ; )

If you encounter this below error and you are trying to send a huge
amount of data over to a widget then here's what's happening. The
default buffer size is too small for the response. When the response
buffer is filled it seems to be automatically committed. When this
happens you get strange errors like the one below or things like "can't
set the header...".

Also if the browser gives a Javascript error like: "Unable to get data
from server: com.google.core.client.JavaScriptException: JavaScript
SyntaxError exception: Unterminated string constant".

So here's what I did. In your servlet just override the service method
like this:

protected void service(HttpServletRequest arg0, HttpServletResponse
arg1)
throws ServletException, IOException {
arg1.setBufferSize(96000); // or some other large size
super.service(arg0, arg1);
}

Roy

[6/29/06 12:56:00:734 CDT] 5f8b8c3a WebGroup I SRVE0181I:
[TestGWTWeb] [/TestGWTWeb] [Servlet.LOG]: Exception while dispatching
incoming RPC call: java.lang.IllegalStateException: ERROR: Cannot set
header. Response already committed.
at
com.ibm.ws.webcontainer.srt.SRTServletResponse.setStatus(SRTServletResponse.java:931)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.writeResponse(RemoteServiceServlet.java:598)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:190)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)

[6/29/06 12:56:00:750 CDT] 5f8b8c3a TraceNLS u No message text
associated with key
WARNING:.Cannot.set.header..Response.already.committed. in bundle
com.ibm.ejs.resources.seriousMessages
[6/29/06 12:56:00:734 CDT] 5f8b8c3a SRTServletRes W WARNING: Cannot set
header. Response already committed.
[6/29/06 12:56:00:953 CDT] 5f8b8c3a WebGroup E SRVE0026E: [Servlet
Error]-[VendorMappingDataServlet]: java.lang.IllegalStateException:
ERROR: Cannot set header. Response already committed.
at
com.ibm.ws.webcontainer.srt.SRTServletResponse.setStatus(SRTServletResponse.java:931)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.respondWithFailure(RemoteServiceServlet.java:542)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:204)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)

Reply all
Reply to author
Forward
0 new messages