0

In spring boot application we are dependent on Sax XML parsers and dozer mappers. So we have used xercesImpl.jar which internally has xml-apis as dependency.
When we install and run application in WAS, giving exception as below,

java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)

When I excluded xml-apis dependency then app is coming up but it's failing to load dozer xmls, with below exception

java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

We have set application class loader config to parent last as spring boot 2.3.12 is conflicting with parent first class loder config.

Versions Spring boot - 2.3.12, xercesImpl.jar - 2.12.2, xml-apis - 1.4, Websphere - 8.5, Class Loader : PARENT_LAST

Summarising - with xml-apis, app is not coming up. If we exclude xml-apis app is coming up but nothing working.

Looking for suggestions.

Thanks,

  • Try to create separate, isolated shared libraries with all the xml, dozer jars and attach it to the server classloader, and run app with parent last option. – Gas Apr 15 '22 at 14:38
  • I was tried to find out which classes in xml-apis were really being used which were not provided in JDK to load XML. Got to know ElementTraversal is the only interface which is missed and rest all were part of JDK. so created that interface alone with same package. that resolved my issue. – Sudheer Apr 16 '22 at 10:23

0 Answers0