aspose file tools
The moose likes XML and Related Technologies and the fly likes HELP!  Xalan/Tomcat/TransformerFactoryConfigurationError Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "HELP!  Xalan/Tomcat/TransformerFactoryConfigurationError" Watch "HELP!  Xalan/Tomcat/TransformerFactoryConfigurationError" New topic
Author

HELP! Xalan/Tomcat/TransformerFactoryConfigurationError

Buzz Andersen
Ranch Hand

Joined: Aug 28, 2001
Posts: 54
Hi,
I am having an extremely frustrating problem trying to get Xalan to work with my web application. I have the xalan.jar and xerces.jar files in my WEB-INF/lib directory, and I have checked to make sure that xalan.jar file does indeed contain the class org.apache.xalan.processor.TransformerFactoryImpl. I am able to run Xalan from the command line (having put it in my system classpath), but when I attempt to get a new transformer factory instance from my web app, I get the following:
javax.xml.transform.TransformerFactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.xalan.processor.TransformerFactoryImpl
at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:121)
at com.megastar.controller.actions.PrintLockForm.perform(PrintLockForm.java)
Why can't my web app seem to find this class even though it is clearly in WEB-INF/lib/xalan.jar? Is this a weird classloader problem? A conflict with some of Tomcat's XML parsing apparatus?
Here is the relevant code from my web app:
TransformerFactory factory = TransformerFactory.newInstance();
Transformer trans = factory.newTransformer(new StreamSource(xsl));
System.out.println( "Transformer classname: " + trans.getClass().getName() );
PrintWriter out = response.getWriter();
trans.transform(new DOMSource(xml), new StreamResult(out));
Any help would be greatly appreciated!!!
Buzz
Buzz Andersen
Ranch Hand

Joined: Aug 28, 2001
Posts: 54
Looks like I may have solved the problem, but I thought I'd post my solution here for posterity :-).
The problem turned out to be rather complex. In my message above I neglected to mention that I'm not using Tomcat alone, but rather one of the joint JBoss/Tomcat distributions. JBoss's lib directory contained a "crimson.jar" file, which I believe was putting JAXP 1.0 on the classpath before the JAXP 1.1 in my WEB-INF directory. Apparently, the current version of Xalan doesn't work with JAXP 1.0. So, I simply downloaded the newest Java XML Pack from Sun's site, replaced the JBoss crimson.jar with the crimson.jar out of the Sun package, and everything seems to be fine.
Buzz
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: HELP! Xalan/Tomcat/TransformerFactoryConfigurationError
 
Similar Threads
Error transforming using TransformerHandler
Bug in JRE XML parser
New Problem: AbstractMethodError w/TransformerFactory
Error transforming XML using TransformerHandler
Error: Namespace not supported by SAXParser