Breaking News
Home / ServerSide / Weblogic / Missing Transformer Factory Implementation

Missing Transformer Factory Implementation

TransformerFactory ExceptionThe following Runtime exception java.lang.NoClassDefFoundError: org/apache/xalan/processor/TransformerFactoryImpl normally happens when we try to convert an DOM object to XML representation.

Exception

The following is an example of on such Exception Stack Trace that is generated.

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/xalan/processor/TransformerFactoryImpl
    at weblogic.xml.jaxp.RegistryTransformerFactory.<init>(RegistryTransformerFactory.java:62)<!>
    at weblogic.xml.jaxp.RegistrySAXTransformerFactory.<init>(RegistrySAXTransformerFactory.java:12)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at javax.xml.transform.FactoryFinder.newInstance(Unknown Source)
    at javax.xml.transform.FactoryFinder.findJarServiceProvider(Unknown Source)
    at javax.xml.transform.FactoryFinder.find(Unknown Source)
    at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
    at com.livrona.snippets.util.DomXmlExample.<init>(DomXmlExample.java:73)
    at com.livrona.snippets.util.DomXmlExample.main(DomXmlExample.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.xalan.processor.TransformerFactoryImpl
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    … 14 more

Cause

Basically in this case the TransformerFactory is created to transform the DOM to XML. The factory tries to find the implementation of the Transformer ( org/apache/xalan/processor/TransformerFactoryImpl) at Runtime but cannot find that class in the ClassPath and throws the exception instead.

Solution

So the simple fix for this issue to add xlan.jar into the classpath and try again. The version of this jar file you use would depend on your JDK version or version of other XML related libraries used to ensure compatibility.

Xalan-Java is an XSLT processor for transforming XML documents into HTML, text, or other XML document types. It implements XSL Transformations (XSLT) Version 1.0 and XML Path Language (XPath) Version 1.0 and can be used from the command line, in an applet or a servlet, or as a module in other program. It can be downloaded from

http://xml.apache.org/xalan-j/

Code Used

The following is the sample code that can cause such an exception to happen if xlan.jar is not in the classpath.

[pb_builder]

Check Also

Error – Remote side declared peer gone on this JVM

Issue When trying to sent a JMS message to a remote Weblogic Application Server the …

Advertisment ad adsense adlogger