您的位置:首页 > 编程语言 > Java开发

Weblogic 10.0 MP1: JAVA.NET.PROTOCOLEXCEPTION IN THE LOGS

2010-11-21 23:14 363 查看

Applies to:

Oracle Weblogic Server - Version: 10.0 to 10.0
Information in this document applies to any platform.

Goal

On deploying their web application 'abc-portal-5.2.5.war', on WLS 10.0 MP1, customer is frequently experiencing the below error:

>>In servlet context "weblogic.servlet.internal.WebAppServletContext@584e97 -
appName: 'abc-portal-5', name: 'abc-portal-5.2.5.war', context-path:
''" failed, java.net.ProtocolException: Didn't meet stated Content-Length,
wrote: '0' bytes instead of stated: '500' bytes..
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes
instead of stated: '500' bytes.

When the above error message is noticed in the logs, web page is not rendered on the client side.
A refresh from the browser returns the page as expected.

The same war when deployed on Tomcat 5.5 works without any issues.
Customer needs to know how to solve this issue?

Solution

The Protocol Exception: Didn't meet stated Content-Length is a "feature" that WebLogic has added to help in ensuring 'what you intend to display on the screen' and 'what is actually being sent (Content Length)'.

Java Core does not enforce these size requirements; WebLogic uses custom Exception Classes for this enforcement. This exception is more of a notice and shouldn't really harm your output. If it does, you catch the exception in the code.

The exception is caused due to the below reasons:
-- closing the connection by closing the browser window abruptly when some response is sent to browser.
-- could also be due to corrupted image file
or
-- network slowness.

Please check the servlet code in the web application to see if more then the set length is being written.

You can also try to add the below code in your servlet application for resolving this issue:
response.setContentLength(0);
...........
............
response.flushBuffer();
return;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐