Reputation: 123
I need two TransformerFactory implementations for my software. I must process xml and xls/fo (formatting object) for PDFs. For newer versions of our software where I want to use user defined xsl functions I use net.sf.saxon.TransformerFactoryImpl which is directly referenced in the sourcecode. Because of old data in database in need to process the old ones with org.apache.xalan.processor.TransformerFactoryImpl, saxon would thrown an error and not render the PDF.
When using Tomcat I just set "-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl" as vm argument and it was no problem.
When using Wildfly setting the vm argument causes wildfly to throw the following exception: "Exception in thread "main" javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found"
A xalan.jar is contained in my war file. A jboss specific version of xalan is part of the Wildlfy distribution.
Why is none of them found? Why does Wildfly even try to load the factory on startup of the wildfly service? How do i configure Wildfly to find the xalan transformer factory during startup? Writing a module entry into standalone.xml or domain.xml does not help.
I am aware that there is a bug in Wildfly saying the redirect of the transformer factory does not point to Wildfly transformer factory but to the java default. I think that should not have any influence on my problem because I try to set another default.
Any help?
Upvotes: 1
Views: 5935
Reputation: 128
I had a similar issue with JBoss 7 and it seem to be the same issue with Wildfly too. Just a wild guess: JBoss loads its configuration files on startup and saves them on shutdown (not sure why but if you make any modifications to standalone.xml while JBoss runs you will see that at shutdown they are overwritten). I guess JBoss need to use a transformer to save its configuration files (standalone.xml) so that is why it loads the transformer at startup (even before the modules configuration was parsed to see that there is a xalan library to be added to classpath and before the war file was deployed). But as I said this is just a guess…I might be completely wrong.
In order to get rid of the startup error you either have to place the xalan library in your $JAVA_HOME/jre/lib/ext (this way you will make it available to all applications) or you could stop using the system property -Djavax.xml.transform.TransformerFactory and add the next property in your standalone.xml file.
<system-properties>
<property name="javax.xml.transform.TransformerFactory" value="org.apache.xalan.xsltc.trax.TransformerFactoryImpl"/>
</system-properties>
Upvotes: 1