Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.6.2
-
Websphere 8.5 on Linux
Description
Recently we upgraded from[Axis2-1.4.1 on Websphere-7.0] to [Axis2-1.6.2 on Websphere-8.5]. And the same application code start giving an intermittent exception. The stacktrace of the exception can be found at the end of the description.
Analysis -
The creation of these system properties is the root cause of the issue.
http.proxyHost and http.proxyPort
These system porperties are created with non-null but empty string "" values.
We find that our application has no logic to create these properties. These properties probably created by a 3rd party library or websphere server.
Workaround -
We write a code to remove these system properties (System.clearProperty()) just before the flow goes to Axis2 part of the application.
We cannot write this code during application startup as these properties are created intermittently when the application is running for few days and the exception appears again.
Recommendations -
In this axis code
package org.apache.axis2.transport.http.util
class HTTPProxyConfigurationUtil
method configure(MessageContext messageContext,
HttpClient httpClient,
HostConfiguration config)
the exception appears at the following line of code -
String port = System.getProperty(HTTP_PROXY_PORT);
if(port != null)
This is because the non-null but empty-string ("") valued key HTTP_PROXY_PORT, results in NumberFormatException.
Can we please add an empty-string value check in the "if" condition ?
Adding further thse empty-string valued keys, both host and port, might overwrite the correct values built from axis2.xml. Hence we can apply the same checks to both of the system properties - host and port - if conditions.
StackTrace -
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
…….
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:59)
at java.lang.Integer.parseInt(Integer.java:481)
at java.lang.Integer.parseInt(Integer.java:510)
at org.apache.axis2.transport.http.util.HTTPProxyConfigurationUtil.configure(HTTPProxyConfigurationUtil.java:154)
at org.apache.axis2.transport.http.AbstractHTTPSender.getHostConfiguration(AbstractHTTPSender.java:294)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:591)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)