web-java.net.SocketException: socket closed

问题描述

java.net.SocketException: socket closed

返回的httpresponse 内容如下
HTTP/1.1 200 OK [Server: zhihu_nginx, Date: Sun, 29 Sep 2013 02:08:35 GMT, Content-Type: application/json, Transfer-Encoding: chunked, Connection: keep-alive, Vary: Accept-Encoding, Expires: Fri, 02 Jan 2000 00:00:00 GMT, Pragma: no-cache, Cache-Control: private, no-store, max-age=0,no-cache, must-revalidate, post-check=0, pre-check=0]

报错如下:
Exception in thread "main" java.net.SocketException: socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
at org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:203)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:174)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.util.zip.GZIPInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.Reader.read(Unknown Source)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:244)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:288)
at zhihu.ZhihuDownload.getAnswersList(ZhihuDownload.java:138)
at zhihu.ZhihuDownload.main(ZhihuDownload.java:54)

时间: 2024-10-27 18:27:23

web-java.net.SocketException: socket closed的相关文章

java.net.SocketException: Socket closed

问题描述 java.net.SocketException:Socketclosedatjava.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)atjava.net.SocketOutputStream.write(SocketOutputStream.java:136)atweblogic.servlet.internal.ChunkUtils.writeChunkTransfer(ChunkUtils.java:2

socket编程发送消息出现socket closed求大神,急

问题描述 socket编程发送消息出现socket closed求大神,急 import java.io.DataInputStream; import java.io.EOFException; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class Server { ServerSocket ss; Socket s ; Clients clients; Da

tomcat集群-TOMCAT 集群 socket closed 错误

问题描述 TOMCAT 集群 socket closed 错误 我在用APACHE配置TOMCAT 集群出现下面这个错误. WARNING: Error receiving mcast package. Sleeping 500ms java.net.SocketException: socket closed at java.net.PlainDatagramSocketImpl.receive0(Native Method) at java.net.PlainDatagramSocketIm

Java Web项目中使用Socket通信多线程、长连接的方法_java

很多时候在javaweb项目中我们需要用到Socket通信来实现功能,在web中使用Socket我们需要建立一个监听程序,在程序启动时,启动socket监听.我们的应用场景是在java项目中,需要外接如一个硬件设备,通过tcp通信,获取设备传上来的数据,并对数据做回应. 先看一下web的监听代码: import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class

【Java TCP/IP Socket】TCP Socket通信中由read返回值造成的的死锁问题(含代码)(转)

书上示例 在第一章<基本套接字>中,作者给出了一个TCP Socket通信的例子--反馈服务器,即服务器端直接把从客户端接收到的数据原原本本地反馈回去. 书上客户端代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 import java.net.Socket; import java.net.Sock

Caused by: java.net.SocketException: Too many open files

问题描述 最近用java多线程socket,发现如下问题.Causedby:java.net.SocketException:Toomanyopenfilesatjava.net.Socket.createImpl(Socket.java:414)atjava.net.Socket.connect(Socket.java:544)atorg.postgresql.core.PGStream.<init>(PGStream.java:61)atorg.postgresql.core.v3.Con

java.net.SocketException: Connection reset 解决方法_java

自从SEOTcs系统11月份24日更新了一下SEO得分算法以来,一直困扰我的一个问题出现了,java的数据job任务,在执行过程中会经常报以下的错误: "2011-12-03 18:00:32 DefaultHttpClient [INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error2011-12-03

java.net.SocketException: 断开的管道错误

问题描述 服务启动后一不定时的报出以下错误<2015-1-12上午11时14分33秒CST><Error><HTTP><BEA-101083><Connectionfailure.java.net.SocketException:断开的管道atjava.net.SocketOutputStream.socketWrite0(NativeMethod)atjava.net.SocketOutputStream.socketWrite(SocketOutp

socket closed

问题描述 privatevoidInit(){try{server=newServerSocket(Integer.valueOf(Source.getCfg("socket.port")));System.out.println("开始监听端口:["+server.getLocalPort()+"]等待客户机连接....");exec=Executors.newFixedThreadPool(pool);while(!this.flag){Li