Jon Hargreaves created TRANSPORTS-56:
----------------------------------------
Summary: Issue with Axis2, jax-ws web service call - HttpClient
3.1/4 java.net.SocketException: Socket Closed due to stale SSL connection, java
8
Key: TRANSPORTS-56
URL: https://issues.apache.org/jira/browse/TRANSPORTS-56
Project: Axis2 Transports
Issue Type: Bug
Components: Base
Affects Versions: 1.7.0
Environment: Oracle Linux: 2.6.18-274.el5 x86_64, tomcat 7.0.68
Reporter: Jon Hargreaves
We are in the process of upgrading an axis2 application from java 6 to java 8
and have been running tests against existing jax-ws axis2 services.
We have a web service, running on tomcat, that is placing a client call, also
via jax-ws to an external web service via an SSL connection.
After switching from java 6 to java 8 we have found that the client call is
still working.
However, when placing a second call to the same web service the call fails with
a "java.net.SocketException: Socket Closed" exception.
This issue is occurring consistently, i.e. if we restart the tomcat server and
then execute the web service which places the client call, via SoapUI, the same
exception is logged.
On further analysis of the log file it seems that, on the second call, the http
connection is being returned from the cache via the httpclient
MultiThreadedHttpConnectionManager class.
The exception is logged, as below:
DEBUG org.apache.commons.httpclient.HttpConnection - An error occurred while
reading from the socket, is appears to be stale
java.net.SocketException: Socket Closed
at
java.net.AbstractPlainSocketImpl.setOption(AbstractPlainSocketImpl.java:212)
at java.net.PlainSocketImpl.setOption(PlainSocketImpl.java:176)
at java.net.Socket.setSoTimeout(Socket.java:1141)
at
sun.security.ssl.BaseSSLSocketImpl.setSoTimeout(BaseSSLSocketImpl.java:631)
at sun.security.ssl.SSLSocketImpl.setSoTimeout(SSLSocketImpl.java:2526)
at
org.apache.commons.httpclient.HttpConnection.isStale(HttpConnection.java:515)
at
org.apache.commons.httpclient.HttpConnection.closeIfStale(HttpConnection.java:431)
at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.closeIfStale(MultiThreadedHttpConnectionManager.java:1313)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:382)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at
org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.executeMethod(HTTPSenderImpl.java:872)
at
org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:212)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:403)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:234)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
It therefore seems that the remote server, to which we are placing the client
jax-ws call, is closing the connection immediately after sending the response
but that the client is not detecting this.
When the next web service call is placed via the client the connection is
retrieved from the connection pool, the httpclient.HttpConnection.isStale()
check is performed, the connection is not correctly detected as being stale and
then the ssl.SSLSocketImpl.setSoTimeout() method is called to reset the socket
timeout, java net then detects that the connection is no longer active and
raises the socket exception.
Note that when this issue occurs it is no longer possible to run this web
service, i.e. the socket exception is then output on every invocation of the
service until the tomcat server is restarted.
Also that I have performed tests with different versions of axis2 and found
that, with version 1.6.0, the same socket exception is output but that a new
connection is then opened and the web service then executes and returns a
response without issue.
Finally, I read the Apache Axis2 1.7.0 release note which states that Axis2
1.7.0 and above supports Apache HttpClient 4.x in addition to the no longer
maintained Commons HttpClient 3.x.
I have attempted to follow the instructions for upgrading the HttpClient to
release 4.x but in the log file I'm still seeing output for
org.apache.commons.httpclient.HttpConnection.
It seems that the change applied to the axis2.xml config file is not taking
effect.
Please could you help with the resolution for the socket exception issue and
also give guidance with upgrading the HttpClient to version 4.2.5.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]