java.net.SocketTimeoutException: Read timed out问题解决

我做的是一个投票软件,在正式投票前,我测试过很多次,都没有出现任何问题,但是正式投票过程中报了一下错误

环境说明:

一个有密码保护的局域网(器材:华为某设备),所有使用者通过ip地址访问服务器,我的电脑为服务器(数据库也在本机上),总共有42个评委,另外三个管理员,加起来就45个左右使用者。

2014-6-28 21:51:22 org.directwebremoting.dwrp.BaseCallHandler marshallException
警告: Exception while processing batch
org.directwebremoting.extend.ServerException: Failed to read input
	at org.directwebremoting.dwrp.Batch.parseBasicPost(Batch.java:224)
	at org.directwebremoting.dwrp.Batch.parsePost(Batch.java:116)
	at org.directwebremoting.dwrp.Batch.(Batch.java:56)
	at org.directwebremoting.dwrp.CallBatch.(CallBatch.java:46)
	at org.directwebremoting.dwrp.BaseCallHandler.handle(BaseCallHandler.java:72)
	at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120)
	at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:141)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:746)
	at org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(InternalInputBuffer.java:776)
	at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:116)
	at org.apache.coyote.http11.InternalInputBuffer.doRead(InternalInputBuffer.java:705)
	at org.apache.coyote.Request.doRead(Request.java:428)
	at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:304)
	at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:405)
	at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:327)
	at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:193)
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
	at java.io.InputStreamReader.read(InputStreamReader.java:167)
	at java.io.BufferedReader.fill(BufferedReader.java:136)
	at java.io.BufferedReader.readLine(BufferedReader.java:299)
	at java.io.BufferedReader.readLine(BufferedReader.java:362)
	at org.directwebremoting.dwrp.Batch.parseBasicPost(Batch.java:181)
	... 20 more

 从错误中可以看出是由于读取超时,而造成dwr出现警告

为了解决这个异常我找了很多办法,但是归根结底是因为:客户端没有在规定的时间内把数据传给服务器,服务器为了保证服务性能,认定那个链接已失效,就出现了这个异常。

 

你可能感兴趣的:(java)