We have an ear application with a singleton ejb which sets up JAXP configuration. We set the TransformerFactory system property via code, with System.setProperty():
System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl");
The jboss-deployment-structure.xml file content is the following:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="org.apache.xalan" slot="main" export="true"/>
<module name="org.apache.xerces" slot="main" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
we got the exception:
Exception in thread "main" javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
If I use the following line of code instead of setting the system property, it works.
TransformerFactory.newInstance("org.apache.xalan.processor.TransformerFactoryImpl", TransformerFactory.class.getClassLoader());
I would like to know why it doesn't work. Do I misunderstand something about JBoss modules class loading?