永发信息网

JAVAWEB 页面跳转时,出现以下报错,寻求解决方案,感谢

答案:2  悬赏:20  手机版
解决时间 2021-01-23 16:45
  • 提问者网友:不爱我么
  • 2021-01-22 21:40
ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:327)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:293)
at org.apache.catalina.connector.Response.flushBuffer(Response.java:545)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:287)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:750)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:432)
at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:305)
at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:997)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
... 13 more
最佳答案
  • 五星知识达人网友:一叶十三刺
  • 2021-01-22 22:33
求相关代码
全部回答
  • 1楼网友:十鸦
  • 2021-01-22 23:15
error [engine] standardwrappervalve[jsp]: servlet.service() for servlet jsp threw exception java.lang.illegalstateexception: getoutputstream() has already been called for this response 从网上找了下资料,综合一下原因分析: 这是web容器生成的servlet代码中有out.write(””),这个和jsp中调用的response.getoutputstream()产生冲突. 即servlet规范说明,不能既调用 response.getoutputstream(),又调用response.getwriter(),无论先调用哪一个,在调用第二个时候应会抛出 illegalstateexception,因为在jsp中,out变量是通过response.getwriter得到的,在程序中既用了response.getoutputstream,又用了out变量,故出现以上错误。 解决方案: 1.在程序中添加: out.clear(); out = pagecontext.pushbody(); 就可以了; 2,不要在%〕〔%之间写内容包括空格和换行符 3,在页面写入图片的时候,需要flush() outputstream output=response.getoutputstream(); output.flush(); 4,在页面确定写入<meta http-equiv=”content-type” content=”text/html; charset=gb2312”>
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯