严重:CouchDBQuery错误。 java.net.SocketException:打开的文件太多

时间:2012-05-02 11:13:31

标签: apache tomcat couchdb httpclient socketexception

当我尝试连接到couchdb时,我收到此错误。有人能告诉我发生这种情况的原因。我是否必须在调用couchdb的方法中为HttpClient和GetMethod分配null?

SEVERE: CouchDBQuery error
java.net.SocketException: Too many open files
    at java.net.Socket.createImpl(Socket.java:397)
    at java.net.Socket.<init>(Socket.java:371)
    at java.net.Socket.<init>(Socket.java:249)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)

1 个答案:

答案 0 :(得分:2)

异常表示没有足够的文件句柄来打开计算机上的套接字。如何在Linux和Windows上检查here

使用HTTPClient时,建议使用其中一个可用的连接管理器来确保关闭连接。

请参阅本指南第2.8节,了解如何使用HTTPClient connection manager