TransformerFactor AbstractMethodError

This little hint is perhaps a bit vague but it’s not completely clear where the problem lies but I know what fixed it.

I had an application that does fairly extensive XML processing and I wanted to get it running on Java 8 in order to replicate a very strange bug that had been reported. The application makes use of a couple of web services exposed by a central server for looking up data. For speed and simplicity the WSDL files are downloaded and stored with the application. At compile time the JAXWS Maven plugin reads the WSDL and generates the appropriate classes for interacting with the web service. So far so standard. What I found was that if the application was compiled on Java 7 it ran fine on Java 7 and Java 8. If the application was compiled and run under Java 8 (clearly it won’t run on Java 7) it failed with the following stack trace:

Caused by: java.lang.AbstractMethodError: javax.xml.transform.TransformerFactory.setFeature(Ljava/lang/String;Z)V
 at com.sun.xml.internal.ws.util.xml.XmlUtil.newTransformerFactory(XmlUtil.java:377)
 at com.sun.xml.internal.ws.util.xml.XmlUtil.newTransformerFactory(XmlUtil.java:385)
 at com.sun.xml.internal.ws.util.xml.XmlUtil.<clinit>(XmlUtil.java:218)
 at com.sun.xml.internal.ws.client.WSServiceDelegate.createCatalogResolver(WSServiceDelegate.java:362)
 at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)
 at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)
 at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)
 at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)
 at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)
 at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:99)
 at javax.xml.ws.Service.<init>(Service.java:77)
 at com.solutions4planning.udt.ws.TranslationLookupService.<init>(TranslationLookupService.java:58)
 at com.solutions4planning.udt.translation.webservice.WebServiceTranslationsFactory.<init>(WebServiceTranslationsFactory.java:40)

What is odd about this exception is that the code compiles fine but then at runtime it has a wobbly and tries to call an abstract method. I don’t know for sure exactly what is going wrong here but the fix was to upgrade Jaxen from 1.1.1 to 1.1.6. I don’t think Jaxen was directly at fault though, I believe the problem was Xalan 2.6.0 which Jaxen 1.1.1 depended one. Jaxen 1.1.6 doesn’t have any dependencies (presumably it can now use the built in transformer). If you’re application does depend on Xalan I think version 2.7.0 and up will work.