ProtocolException is thrown if multibyte characters is specified for HttpServletResponse.sendError method (Doc ID 1902525.1)

Last updated on JANUARY 14, 2016

Applies to:

Oracle WebLogic Server - Version 10.3.1 to 10.3.6
Oracle WebLogic Server - Version 12.1.1.0 to 12.1.3.0.0 [Release 12c]
Information in this document applies to any platform.

Symptoms


ProtocolException is thrown if javax.servlet.http.HttpServletResponse.sendError(int sc, String msg) method is executed with the second argument 'msg' that includes multibyte characters. HTTP client cannot receive all the error message specified for sendError method.

The exception and related error are logged in WLS server log.

####... <Error> <HTTP> ... <BEA-101083> <Connection failure.
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '9' bytes instead of stated: '3' bytes.
        at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:463)
        at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1496)
        at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1570)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1574)
        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
>

The code specified for the first argument 'sc' of sendError method is logged in access.log as HTTP status code.

xxx.xxx.xxx.xxx - - [...] "GET /SendErrorServlet/senderrorservlet HTTP/1.1" 500 3

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms