I have been running into a string of issues with Axiom and Mule, a background can be found here:
https://stackoverflow.com/questions/34164577/classloader-overrides-not-working-in-mule
As mentioned in the comment of the previous issue, I was able to use maven shade to override the package name of axiom-api in mule due to conflicting jars. Mule loads a version of axiom-api and axiom-impl in the server. I use a different version of axiom-api and axiom-dom in my connector. (The connector works fine testing outside of anypoint studio)
Using maven shade, I renamed:
org.apache.axiom
to
org.apache.1.2.14.axiom
This resolved my original issue of a method not found due to the conflicting jar versions. Now the problem I am running into is:
org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactoryLoader cannot be cast to org.apache.1.2.14.axiom.locator.loader.OMMetaFactoryLoader (java.lang.ClassCastException) org.apache.1.2.14.axiom.locator.ImplementationFactory:133 (null)
I believe this is due to renaming the packages of axiom-api with maven shade. My maven shade configs look like this:
<configuration>
<artifactSet>
<includes>
<include>org.apache.ws.commons.axiom:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.apache.axiom</pattern>
<shadedPattern>org.apache.1.2.14.axiom</shadedPattern>
</relocation>
</relocations>
</configuration>
So, it should actually be renaming axiom-dom as well but it does not.
I believe this is due to classloader only loading one instance of the axiom-dom packages. To resolve this, I believe I just need to rename:
org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactoryLoader
to
org.apache.1.2.14.axiom.om.impl.dom.factory.OMDOMMetaFactoryLoader
I found an example of axiom.xml:
I cant find any documentation over this file but I see where it is used in source code. I thought I could rewrite:
<implementation loader="org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactoryLoader" name="doom">
<feature name="dom" priority="100"/>
</implementation>
to
<implementation loader="org.apache.1.2.14.axiom.om.impl.dom.factory.OMDOMMetaFactoryLoader" name="doom">
<feature name="dom" priority="100"/>
</implementation>
but that had no effect. Is there a way to override the doom loader class name?