[WF-9] Speeding up and changing BuilderFactory
massimiliano.masi Aug 23, 2016 10:27 AMHi All,
As in a previous post, I am facing strange problems with wildfly9 and XML DOM implementations.
I actually found here: https://access.redhat.com/solutions/97793 that adding to the java opts
JAVA_OPTS="$JAVA_OPTS -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
It sets an unique implementation to the FactoryFinder (without falling back into com.sun.org.apache.xerces, sometimes to saaj, etc), and it also increases the performance. But by setting this value in wildfly 9, I have:
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/bin/jboss1
JBOSS_OPTS: '-c' 'standalone.xml' '-b' '0.0.0.0' '-bmanagement' '0.0.0.0' '-Djboss.socket.binding.port-offset=0' '-Djboss.node.name=jboss1' '-Djboss.instance.name=jboss1' '-Djboss.server.config.dir=/opt/conf/jboss1/configuration' '-Djboss.server.base.dir=/opt/bin/jboss1/standalone' '-Duser.dir=/opt/conf/jboss1' '-DspiritCfgDir=/opt/conf/jboss1/spiritCfg' '-Djboss.server.deployment.dir=/opt/conf/jboss1/deployments' '-Djboss.server.log.dir=/opt/logs/jboss1' '-Djboss.Log4j.file=/opt/conf/jboss1/configuration/log4j.xml' '-Djboss.Logs.dir=/opt/logs/jboss1' '-Djboss.STL.dir=/opt/logs/STL' '-Djava.endorsed.dirs=/opt/bin/jboss1/java.endorsed.dirs' '-Djboss.Key.file=/opt/Certificates/eb2.tiani-spirit.int.jks' '-Djboss.Key.alias=eb2.tiani-spirit.int' '-Djboss.Key.pwd=spirit' '-Djboss.Trust.file=/opt/Certificates/BeS_Truststore.jks' '-Djboss.Trust.pwd=spirit'
JAVA: /opt/bin/java/bin/java
JAVA_OPTS: -server -d64 -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Dhttps.protocols=TLSv1.2 -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
=========================================================================
Listening for transport dt_socket at address: 8787
Exception in thread "main" javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:200)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:152)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:232)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
at __redirected.__DocumentBuilderFactory.<clinit>(__DocumentBuilderFactory.java:58)
at __redirected.__JAXPRedirected.initAll(__JAXPRedirected.java:72)
at org.jboss.modules.Module$1.run(Module.java:129)
at org.jboss.modules.Module$1.run(Module.java:116)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.modules.Module.<clinit>(Module.java:116)
at org.jboss.modules.Main.main(Main.java:375)
Caused by: java.lang.ClassNotFoundException: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:124)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:188)
... 10 more
Any idea on where to add the xerces API?
I have the following module in org/apache/xerces/main/module.xml
<module xmlns="urn:jboss:module:1.3" name="org.apache.xerces">
<resources>
<resource-root path="xercesImpl-2.11.0.SP3.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
And I have another instance for debug in another module directory, of my application.
Any hints?
Thanks