I have an application that is using Apache CXF to communicate with Axis2 web service. On the test environment everything went smoothly, moving to the production environment the following exception occurs:
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:75)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy131.retrieveAccountSummary(Unknown Source)
.
.
.
Caused by: java.net.SocketException: Socket Closed
at java.net.PlainSocketImpl.setOption(PlainSocketImpl.java:201)
at java.net.Socket.setTcpNoDelay(Socket.java:850)
at weblogic.net.http.HttpClient.openServer(HttpClient.java:326)
at weblogic.net.http.HttpClient.openServer(HttpClient.java:411)
at weblogic.net.http.HttpClient.New(HttpClient.java:241)
at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:176)
at weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:242)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1836)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1794)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:70)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1854)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:595)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 40 more
as far as I was told, nothing on the network is terminating the connections, and I increased the ConnectionTimeout and the RecievingTimeout from cxf configuration but no use.
Both applications are deployed on weblogic 10.3.2.0 on different servers, I need some guidance on where could the problem be? what could cause a socket to be closed? I don’t want to be looking into things that are not related to this problem.
The issue is solved now.
The CXF client was accessing the WSDL without any problems, but in the WSDL the service port address was set to
localhostinstead of the IP address of the server:my application was trying to send the requests to
localhostand of course aSocketExceptionwas the result.The soap address is set to
localhostin the original WSDL, however, when I created Axis2 web service and deployed it on the test environment, the address was getting updated to the machine IP address (which did not happen on the UAT).I’m not sure how and when the soap address gets updated, but I guess when the machine has more than one network interface, Axis leaves the address as is or maybe updates it to
localhost.Now to fix this issue I had to override the service address as follows: