Skip to content

AXIS Client 1.4 with JDK 8 gives org.apache.axis.AxisFault: java.util.ConcurrentModificationException

I am using AXIS (1.4) client to invoke SOAP web services and JDK version is 8. Getting following intermittent error for some of the SOAP service invocations. This is happening for 5-10 requests out of 1000 requests under load condition.

Caused by: org.apache.axis.AxisFault: java.util.ConcurrentModificationException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:223) ~[axis-1.4.jar:na]
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:130) ~[axis-1.4.jar:na]
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1104) ~[axis-1.4.jar:na]
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) ~[na:na]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) ~[na:na]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) ~[na:na]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[na:na]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[na:na]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[na:na]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[na:na]
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) ~[na:na]
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) ~[na:na]
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:241) ~[axis-1.4.jar:na]
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) ~[axis-1.4.jar:na]
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435) ~[axis-1.4.jar:na]
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62) ~[axis-1.4.jar:na]
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invokeEngine(Call.java:2782) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:2765) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:2443) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:2366) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:1812) ~[axis-1.4.jar:na]
at com.te.prodirectory.services.client.PaymentWSSoapBindingStub.validateVamPayment(PaymentWSSoapBindingStub.java:423) ~[directory-qe-client-3.2.0-VAM2-RC24.jar:3.2.0-VAM2-RC24]
at com.te.prodirectory.services.payment.PaymentServiceWsImpl.validateVamPayment(PaymentServiceWsImpl.java:34) ~[directory-qe-client-3.2.0-VAM2-RC24.jar:3.2.0-VAM2-RC24]
... 37 common frames omitted

NOTE: When we used same AXIS client with JDK 7, did not face this issue at all.

I tried searching for similar issue of AXIS with JDK 8, there are some compatibility issues, but nothing like the one that I am facing currently.

Answer

Agree that https://issues.apache.org/jira/browse/AXIS-2909 seems to be the issue. Going back to jdk7 is usually not an option.

The suggestion in AXIS-2909 is to take latest 1.4.1-SNAPSHOT, from a successful jenkins build in 2017. This is coming from http://svn.apache.org/repos/asf/axis/axis1/java/trunk, and to put it short this trunk has undergone a lot of changes since 2006 (1.4), and is not officially released. – added maven support – completely restructured into maven modules – a lot of different changes, check svn log

veithen (A. Veithen) has done an excellent job within this trunk, and seems to be the maintainer.

A better approach, and safer, given you want only to fix the axis ConcurrentModificationException bug, and not introduce more changes than needed, can be to take the 1.4 tag, and apply patch on top of that.

https://svn.apache.org/repos/asf/axis/axis1/java/tags/1.4/

patch:

   // Convert to array before sorting to avoid concurrency issues
    OperationDesc[] array = (OperationDesc[])overloads.toArray(
        new OperationDesc[overloads.size()]);


    Arrays.sort(array,
        new Comparator() {
            public int compare(Object o1, Object o2)
            {
                Method meth1 = ((OperationDesc)o1).getMethod();
                Method meth2 = ((OperationDesc)o2).getMethod();
                return (meth1.getParameterTypes().length -
                                     meth2.getParameterTypes().length);
            }
        });

    return array;
}

btw: AXIS-2875 is also needed, to make it compile with java8.

please note that this will be a time machine experience, as you are back in the ant build-script days. you will also need to incl j2ee-1.4.jar as compile-time lib. but then you are good to go, and can bake your own 1.4.1 containing 1.4 +AXIS-2909