Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got it working. </p> <p>In jboss in addition to modules which we can exclude there is another jar that’s at the root C:\jboss-eap-6.0\jboss-modules.jar. Inside this jar there is folder called “__redirected” with a class __TransformerFactory.class with following code.</p> <pre><code>Class clazz = __RedirectedUtils.loadProvider(id, javax/xml/transform/TransformerFactory, loader); </code></pre> <p>This forces the “org.apache.xalan.processor.TransformerFactoryImpl” to be loaded from C:\jboss-eap-6.0/jboss-modules.jar</p> <p>However this is not a module so I can’t exclude it using jboss-deployment-structure.xml, though I had exclude the following jboss modules for Xalan, Xercel and XML api . As we have a specific jars in the EAR lib to satisfy this.</p> <p>jboss-deployment-structure.xml</p> <pre><code>&lt;jboss-deployment-structure xmlns:p="urn:jboss:deployment-structure:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;deployment&gt; &lt;exclusions&gt; &lt;module name="org.apache.xerces" /&gt; &lt;module name="org.apache.xalan" /&gt; &lt;module name="org.apache.xml-resolver" /&gt; &lt;/exclusions&gt; &lt;/deployment&gt; </code></pre> <p></p> <p></p> <p>So I commented the following code </p> <pre><code> stfactory = (SAXTransformerFactory) TransformerFactory.newInstance(); </code></pre> <p>and added </p> <pre><code> Class clazz = Class.forName("org.apache.xalan.processor.TransformerFactoryImpl"); stfactory = (SAXTransformerFactory) clazz.newInstance(); </code></pre> <p>Now I see that </p> <ul> <li><p>org.apache.xalan.processor.TransformerFactoryImpl is getting loaded from C:/jboss-eap-6.0/standalone/deployments/TST.ear/lib/xalan-2.7.0.jar</p></li> <li><p>The call stfactory.newTransformerHandler(streamSource) returns “org.apache.xalan.transformer.TransformerHandlerImpl” and not “org.apache.xalan.transformer.TransformerIdentityImpl”</p></li> </ul> <p>So I believe that the jar “C:\jboss-eap-6.0\jboss-modules.jar” is part of class loader and above the EAR class loader. So it was not using Xalan.2.7.0.jar for “org.apache.xalan.processor.TransformerFactoryImpl”. However when we call stfactory.newTransformerHandler(streamSource) it would return “org.apache.xalan.transformer.TransformerIdentityImpl” .</p> <p>May be there is something buried in C:\jboss-eap-6.0\jboss-modules.jar for this behavior.</p> <p>What I don’t understand was in one of tests I did use Xalan.2.7.0.jar and added that in java.endorsed.dir it was still using C:\jboss-eap-6.0\jboss-modules.jar which is little surprising as I thought the jars in endorsed will be loaded even before C:\jboss-eap-6.0\jboss-modules.jar.</p> <p>But anyway the current fix resolves the problem and it happens only on Jboss application server 7. The code works without any changes in Webspshere 7.0 and also when I run it as standalone java program.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload