We have an EAR we are converting from JBoss 4 to Wildfly 9 and our customer needs to use an older version of XALAN.
In jboss-deployment-structure.xml we exclude the modules: org.apache.xalan and org.apache.xerces and have the older version of XALAN in the EAR’s lib folder. We’ve confirmed that if we import the class we get the older version of XALAN.
However when we use JAXP to get XPath xpath = XPathFactory.newInstance().newXPath(); we get a: ClassCastException: org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to org.apache.xml.dtm.DTMManager.
We found the issue is that XPathImpl and XPathExpression are pulled from the Wildfly system modules. We found this by printing the paths the class loader is using.
However if we remove the javax.xml.xpath.XPathFactory file from the modules jar, xalan-2.7.1.jbossorg-1.jar, it works. In this scenario the class loader reports its using the JDK version of these classes: jre/lib/rt.jar!/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.class (Java 8).
We realize this is not an optimal work around that may have negative impacts.
Any ideas on a proper approach to make Wildfly use Java 8’s classes instead of the Wildfly module?