当前位置: 代码迷 >> Web前端 >> websphere抛出java.lang.IllegalStateException: SRVE0199E: 已获取了输出流 异常
  详细解决方案

websphere抛出java.lang.IllegalStateException: SRVE0199E: 已获取了输出流 异常

热度:2407   发布时间:2012-11-07 09:56:10.0
websphere抛出java.lang.IllegalStateException: SRVE0199E: 已获取了输出流 错误

转载自:http://blog.csdn.net/flysky_lfx/article/details/1663429
?3050人阅读?评论(1)?收藏?举报

websphere文件下载问题

00000031 ServletWrappe E SRVE0068E: 无法调用 servlet /test/test.jsp 的 service() 方法。抛出异常:java.lang.IllegalStateException: SRVE0199E: 已获取了输出流?
at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java:463)?
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:170)?
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:163)?
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:216)?
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:149)?
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:117)?
at com.ibm._jsp._SceneReport._jspService(_SceneReport.java:101)?
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)?
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)?
at com.ibm.ws.http.channel.inbound.impl.?

[05-10-18 15:27:23:598 CST] 00000031 ServletWrappe E SRVE0014E: 未捕捉到 service() 异常的根本原因 /taking/SceneReport.jsp:SRVE0199E: 已获取了输出流?
[05-10-18 15:27:23:618 CST] 00000031 SystemOut O doFilter 1:javax.servlet.ServletException: SRVE0199E: 已获取了输出流??

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1216)?
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1177)?
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)?
at com.mcm.util.tools.SessionFilter.doFilter(SessionFilter.java:195)?
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)?
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)?
at com.mcm.util.tools.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:119)?
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)?
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)?
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:627)?
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:173)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)?
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1752)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)?
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:466)?
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:405)?
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:104)?
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:555)?
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)?
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:941)?
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1028)?
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

?

?

?

原因:

原因是由于Servlet 规范不同造成的.?
Servlet1.2规范规定了OutputStream只能获得一次,在jsp中实际上已经通过内置对象out获得过一次,所以在程序里输出excel等文件时需要再getOutoutStream时就会报:OutputStream already obtained, WAS6里面遇上这种情况就直接报错并且不会正确执行输出,而WAS5。0只是报错但是还是允许输出。WAS6实际上对规范的实现更加严格了。?

解决方法:将进行输出的jsp改用servlet实现。因为servlet里面没有内置的out对象,所以程序执行etOutoutStream就不会出错

  相关解决方案