27 April 2010

How to Fix Tomcat5 on RHEL5 org.apache.xalan.processor.TransformerFactoryImpl not found

I got this exception trying to start a Grails app on a RHEL5 box using OpenJDK and Tomcat5, all installed from Yum.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'annotationHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]: Constructor threw exception; nested exception is javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found at java.lang.Thread.run(Thread.java:636)

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]: Constructor threw exception; nested exception is javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found

To fix I did a yum install of xerces and xalan, created a symlink from $catalina_home/common/endorsed/xalan.jar to /usr/share/java/xalan-j2.jar and restarted Tomcat.