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.

3 comments:

  1. Great Thanks.
    Despite it is simple the syntax to create symoblic link help. In my case :
    catalina_home=/usr/share/tomcat5/
    ln -s /usr/share/java/xalan-j2.jar $catalina_home/common/endorsed/xalan.jar
    ls -l $catalina_home/common/endorsed/xalan.jar
    /etc/init.d/tomcat5 restart

    ReplyDelete
  2. java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

    ReplyDelete
  3. Thanks!! Very helpful

    ReplyDelete