본문 바로가기
IBM - old/WAS 문제&해결

SRVE0216E: post body contains less bytes than specified by content-length

by freeman98 2016. 5. 6.

1. WAS 버전 : WebSphere ND v6.1.0.23

2. OS : Red Hat Enterprise Linux 4

3. Error message :

[5/29/09 12:26:05:068 KST] 00000053 SRTServletReq E   SRVE0133E: An
error occurred while parsing parameters. java.io.IOException:
SRVE0216E: post body contains less bytes than specified by
content-length
    at com.ibm.ws.webcontainer.servlet.RequestUtils.parsePostData(RequestUtils.java:301)
    at com.ibm.ws.webcontainer.srt.SRTServletRequest.parseParameters(SRTServletRequest.java:1642)
    at com.ibm.ws.webcontainer.srt.SRTServletRequest.getParameterNames(SRTServletRequest.java:1277)
    at testWeb.doPost(testWeb.java:58)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1143)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:591)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3453)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)  
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:556)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:606)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:979)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1064)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

4. 예상 이유 :
Exception 문구에도 나와있지만 HTTP header 값인 content-length 보다 작은 content 즉 body의 내용이 적게 있으므로 본 예외가 발생하게 됨니다. 현재 Servlet 소스상에서 getInputStream() 이후 getParameter() 관련 함수를 호출하므로 getInputStream() 에서 body를 이미 다 읽어온 후라 getParamter() 관련 함수가 호출이 안되고 예외가 발생하는 현상입니다.

5. 조치 방법 : 흔히 Double Read Problem 이라는 용어로 불리워지는 문제이며, 알려진 바로는 WebLogic 에서는 정상적으로 작동하나 IBM WebSphere 에서 발생하는 예외로 알려져 있습니다. 이는 IBM WebSphere 의 문제가 아니라 Servlet Spec 을 명확히 준수해서 발생하는 이슈입니다. 따라서 WebSphere 를 사용하시는 경우에는 getInputStream() 이나 getParamter() 관련 함수를 동시에 쓰지 마시고 둘 중 하나만 선택해서 사용하시기 바라겠습니다.

추신: Servlet 2.4 스펙에서 제한이 명시되어 있는 부분입니다.

댓글