2 bulls33 bulls33 于 2013.06.07 15:27 提问

java.net.SocketException too many open files

下面是错误信息:
2013-6-3 11:10:52 org.apache.http.impl.client.DefaultRequestDirector tryConnect
信息: I/O exception (java.net.SocketException) caught when connecting to the target host: Too many open files
2013-6-3 11:10:52 org.apache.http.impl.client.DefaultRequestDirector tryConnect
信息: Retrying connect
java.net.SocketException: Too many open files
at java.net.Socket.createImpl(Socket.java:397)
at java.net.Socket.getImpl(Socket.java:460)
at java.net.Socket.setSoTimeout(Socket.java:1017)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:126)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
at org.whu.weibo.util.NextPage.getPage(NextPage.java:48)
at org.whu.weibo.content.NTESweibo.crawler(NTESweibo.java:42)
at org.whu.Scan.scanByPage(Scan.java:27)
at org.whu.Scan.run(Scan.java:17)
at java.lang.Thread.run(Thread.java:662)

2个回答

ren_list
ren_list   2013.06.07 15:33
已采纳

看异常,java.net.SocketException: Too many open files 你打开的文件太多,少开几个几个文件试试

bulls33
bulls33 谢谢,我查了一些文档也是说打开的文件太多,已修改,目前还没有出错,不敢确定。因为我也是在程序跑了一个月后出现的问题,所以还在观察。
接近 5 年之前 回复
Jave_
Jave_   2013.06.07 15:31

连接数过多,是否socket未正常关闭

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!