Old Version of Commons-HttpClient gives IOException in the Axis2 Web Service Client - axis2

I am using a wsdl2java generated web service client for the axis2 web service (axis2 version is 1.6.1). So for http connection the old version of commons-httpclient 3.1 is used. While doing some load tests to my web service client. In some cases i came across this exception
org.apache.axis2.AxisFault: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16706)
at com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.wSgetById(WSStorageServiceStub.java:6659)
at com.ardic.arcsp.update.wsclient.WSStorageServiceClient.getResourceById(WSStorageServiceClient.java:177)
at com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.downloadResource(OTAUpdateTestServlet.java:162)
at com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.doGet(OTAUpdateTestServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:273)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:305)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:298)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:57)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.wso2.carbon.server.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:154)
at org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:254)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:705)
Caused by: org.apache.axiom.om.OMException: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:172)
at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:705)
at org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:623)
at org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:350)
at org.apache.axiom.om.impl.builder.OMAttachmentAccessorMimePartProvider.getDataHandler(OMAttachmentAccessorMimePartProvider.java:45)
at org.apache.axiom.util.stax.xop.XOPDecodingStreamReader$DataHandlerProviderImpl.getDataHandler(XOPDecodingStreamReader.java:81)
at org.apache.axiom.util.stax.xop.XOPDecodingStreamReader.getDataHandler(XOPDecodingStreamReader.java:472)
at org.apache.axiom.om.impl.SwitchingWrapper.getDataHandler(SwitchingWrapper.java:1360)
at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:230)
at com.ardic.arcsp.carbon.registry.ws.stub.xsd.WSResource$Factory.parse(WSResource.java:2087)
at com.ardic.arcsp.carbon.registry.ws.stub.WSgetByIdResponse$Factory.parse(WSgetByIdResponse.java:417)
at com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16273)
... 37 more
Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114)
at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
at org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:136)
... 48 more
Caused by: java.io.IOException: CRLF expected at end of chunk: 116/161
at org.apache.commons.httpclient.ChunkedInputStream.readCRLF(ChunkedInputStream.java:207)
at org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:219)
at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:176)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at java.io.PushbackInputStream.read(PushbackInputStream.java:169)
at org.apache.axiom.attachments.BoundaryPushbackInputStream.readFromStream(BoundaryPushbackInputStream.java:114)
at org.apache.axiom.attachments.BoundaryPushbackInputStream.read(BoundaryPushbackInputStream.java:248)
at org.apache.axiom.attachments.MIMEBodyPartInputStream.read(MIMEBodyPartInputStream.java:87)
at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
... 50 more
The web service client request files from the server and downloads the file. These exceptions occurs on the response while receiving files in chunks.
While searching i came across this fix mentioned here.
https://issues.apache.org/jira/browse/HTTPCORE-190
However the exceptions still occur. So what else can cause this exceptions?
UPDATE:
Ok, i got the real reason for exception.On the client side if the memory allocation for jvm is low, the response from the server cannot be processed due to SocketTimeOut. But the exception itself could not stress this. Increasing the heap on the client side can solve the problem temporary.

You definitely need enough memory to hold all the data that is chucked to the client. Java can give really weird results, especially the older JVMs, when there isn't enough memory to go around. It can be tricky sometimes to identify that as the root cause so bravo on that find.
There are a few helpful big on the Apache Axis2 User's Guide - Creating Clients page that might be helpful if you are new to wsdl2java.
Our next step is to learn what command line options are available. One thing you can try is using the -u option to generate separate classes for the data bindings instead of creating them as inner classes. (Take a look at this Stack Overflow question.)
Since this question is 10 years old if you run into this or another error please create a new question specific to that context.

Related

Spring RabbitMQ - Getting ClassCastException in MessageListener

I am getting ClassCastException from AMQP internals while using Spring RabbitMQ. We found this in application logs on production and were not able to reproduce this, but it's a real pain for us.
Basically, it seems like the entire stack fails once this happens, because then we see invalid DeliveryTag being sent on that channel, which results in RabbitMQ closing this channel.
We are using AMQPClient 5.4.3 and SpringRabbit 2.1.2, RabbitMQ caching mode is Connection (because of HAProxy and failover), ACK mode is manual, Publisher returns are enabled and Publisher Confirms as well.
java.lang.ClassCastException: com.rabbitmq.client.impl.AMQImpl$Channel$OpenOk cannot be cast to com.rabbitmq.client.impl.AMQImpl$Confirm$SelectOk
at com.rabbitmq.client.impl.ChannelN.confirmSelect(ChannelN.java:1552)
at com.rabbitmq.client.impl.ChannelN.confirmSelect(ChannelN.java:52)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.doCreateBareChannel(CachingConnectionFactory.java:658)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createBareChannel(CachingConnectionFactory.java:649)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getCachedChannelProxy(CachingConnectionFactory.java:608)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getChannel(CachingConnectionFactory.java:499)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.access$1600(CachingConnectionFactory.java:100)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.createChannel(CachingConnectionFactory.java:1331)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1967)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1935)
at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:889)
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:955)
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:948)
at net.homecredit.lisa.messaging.amqp.SaveApplicationResponseProducer.sendResponse(SaveApplicationResponseProducer.kt:40)
at net.homecredit.lisa.messaging.amqp.SaveApplicationConsumer.onReceiveRequestMessage(SaveApplicationConsumer.kt:87)
at sun.reflect.GeneratedMethodAccessor372.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:170)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120)
at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:49)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:190)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:127)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1521)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1444)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1431)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1410)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:848)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:832)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:78)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1073)
at java.lang.Thread.run(Thread.java:748)
This is complete mystery for me.
Does anyone know what's wrong?
The RabbitMQ client can be configured to check the response type for RPC via channelShouldCheckRpcResponseType, see also https://github.com/rabbitmq/rabbitmq-java-client/issues/708.

EofException when doing a deployment using the Tooltwist Controller

I'm deploying a ToolTwist application to a production server using FIP, and Im getting this error on Transfer Phase.
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
and in the fipserver console
org.eclipse.jetty.io.EofException
at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:892)
at org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:486)
at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:424)
at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:78)
at org.eclipse.jetty.server.HttpConnection$Output.flush(HttpConnection.java:1094)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:159)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:98)
at tooltwist.fip.jetty.GetFileListServlet.doGet(GetFileListServlet.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:94)
what should be the solution for this?
This error is occuring in the first stage of the FIP file transfer, where the fipserver creates an index of the existing files on the destination server. This is done in GetFileListServlet.doGet(), which can be seen in the stack trace. It is also indicated on the client side by the message...
Indexing source...
Indexing destination...
ERROR: java.net.SocketTimeoutException Read timed out
Exception: tooltwist.fip.FipException: java.net.SocketTimeoutException: Read timed out
This indexing process involves creating a hash for each file on the destination server, which the fip client then compares with the hashes of files on the source machine. It does this to determine which files are different, and so need to be installed.
A read timeout occurs when the client is waiting too long for the FIP server to index the files on the destination machine. Indexing is normally a fairly quick process, but does involve reading all the files beneath the destination directory (e.g. in ~/server). If monsterously huge files exist within that destination directory then the scanning will take a proportionately long time to complete. If that time is too long, then the client times out and drops the connection, and the server also sees the connection was dropped and stops indexing.
The most common cause of this error is excessively large log files in ~/server/tomcat/logs. If you clean those up, the problem should go away.

Getting "java.lang.NoClassDefFoundError: weblogic/application/ApplicationStateListener" while deploying application into Weblogic server

Getting NoClassDefFoundError after adding listener "ADFApplicationStateListener" in weblogic-appliations.xml.
Earlier weblogic-applications.xml has listener "ADFApplicationLifecycleListener". I am able to deploy the application with this listener.
But as per the mandates specified in the section "Custom ADF application Deployment requirements" of JDeveloper documentation in the below link, I have configured with the "ADFApplicationStateListener" listener.
http://www.oracle.com/technetwork/developer-tools/jdev/documentation/121200-rn-1917713.html
How can I resolve this error ?
Thanks,
Gopal.
Caused by: java.lang.NoClassDefFoundError: weblogic/application/ApplicationStateListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:101)
at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:86)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at weblogic.application.internal.flow.BaseLifecycleFlow$CreateListenerAction.run(BaseLifecycleFlow.java:140)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.application.internal.flow.BaseLifecycleFlow$BaseAction.invoke(BaseLifecycleFlow.java:104)
at weblogic.application.internal.flow.HeadLifecycleFlow.createListener(HeadLifecycleFlow.java:117)
ApplicationStateListener is introduced in Weblogic server as part of following bug fix :-
Here the bug is there is no callback for cleanup the ADF resources while stopping the application in weblogic server.
Actually postStop() method of ApplicationLifecycleListener will do this while removal or undeployment of the application.
But when an application requires only restart, i.e stop the application and start it again (no need to undeploy & deploy) then there is no callback for ADF MDS related resources cleanup.
So, ApplicationStateListener is introduced to have a callback for resource cleanup while stopping the application.
My Weblogic server(version 10.3.6.0) is not applied with the patch (patch 56MM) which has the above bug fix.
So, if want to continue with ApplicationStateListener I have to apply the patch, otherwise I have to continue with the ApplicationLifecycleListener.

JBoss AS7 Hornetq - RemoteConenctionFactory lookup fails with RoundRobinConnectionLoadBalancingPolicy NotSerializableException

I'm using JBoss AS 7 Hornetq. Our standalone java application interacts with a queue and sends messages. We had the entire environment setup and it was working pretty smoothly. Suddenly, one fine day, our standalone application failed with the below exception:
Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
Detailed exception stack trace is below
javax.naming.NamingException: Failed to lookup [Root exception is java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.infosys.lbs.publishing.LocationProcessor.postMessageInQueue(LocationProcessor.java:377)
at com.infosys.lbs.publishing.LocationProcessor.process(LocationProcessor.java:69)
at com.infosys.lbs.publishing.main.Publisher.main(Publisher.java:34)
Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:891)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at org.jboss.naming.remote.protocol.v1.Protocol$1$2.write(Protocol.java:138)
at org.jboss.naming.remote.protocol.v1.WriteUtil.write(WriteUtil.java:61)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:128)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: an exception which occurred:
in field loadBalancingPolicy
in field serverLocator
in object org.hornetq.jms.client.HornetQJMSConnectionFactory#ea074d
Exception was happening when the app was trying to lookup the connection factory
QueueConnectionFactory qcf = (QueueConnectionFactory)context.lookup("jms/RemoteConnectionFactory");
Below are the steps on how we resolved the issue
There was almost zero help for resolving this issue. A web search on this exception returned next to nothing. However, this particular thread on JBoss AS Dev site spinned a thought in my head: RemoteConnectionFactory is not found when looking up in a remote client
The scenario mentioned in this thread was not same as ours. (In our app this is the first and the only lookup happening.) This thread got me thinking towards a possible connection factory initialization issue. While there is nothing I could do to debug or find the issue around it, I thought that if I could reinitialize it, that would help.
So I tried lookup with java:jboss/exported/jms/RemoteConnectionFactory As expected it failed with a NamingException. Hoping that this naming syntax (using java:/) would have resulted in a reinitialization, I tried lookup again with jms/RemoteConnectionFactory. And bingo!!! it worked!
Unfortunately, we still don't know why it happened, and if it is just a one-off case! Documenting it here just in case some mortal soul hits this issue.

SEVERE: CouchDBQuery error. java.net.SocketException: Too many open files

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)
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