Reputation: 573
When i try to connect to couchdb I get this error. Can someone tell me the reasons why this is happening. Do I have to assign null to HttpClient and GetMethod in a method which is calling couchdb?
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)
Upvotes: 2
Views: 949
Reputation: 31371
The exception means there are not enough file handles to open sockets on your machine. How to check this on Linux and Windows is here.
With HTTPClient, it's recommended to use one of the connection managers available to ensure shutting down of connections.
See Sec 2.8 of this guide on how to use HTTPClient connection manager
Upvotes: 2