In one of our projects we are using axis2 1.4 for generating the client side of the web service. Our web service part is working for few hours but gets stuck for no apparent reason. After I investigate a little I saw that it generates lots of sockets with CLOSE_WAIT state which results this freeze. I google a bit about similar problems with Axis2 and saw that this a known bug. Here's the
source I used for fixing it. As explicitly calling the garbage collector didn't seem like a good solution, and as I can't upgrade axis2, I opt for changing the HTTP version to 1.0. For this I set a single field in the ServiceStub by calling
serviceStub._getServiceClient().getOptions()
.setProperty(
org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10)
from ServiceStub where this object is created.
After that, this CLOSE_WAIT bug is fixed.