"SAX2 driver class org.apache.crimson.parser.XMLReaderImpl not found" when using Batik in a webapp on Tomcat

Matt picture Matt · Apr 3, 2009 · Viewed 8.7k times · Source

This is possibly related to a classpath problem, but I'm really not sure at this point, since I don't get this error on some machines.

The error at the top of the stack is SAX2 driver class org.apache.crimson.parser.XMLReaderImpl not found. Why would I get this error only in some environments, but not others? How can I further investigate and/or fix this?

Environments:

  • Jetty on Mac or PC == OK
  • Tomcat 5 or 6 on Mac == OK
  • Tomcat 5 or 6 on Win XP == ERROR
  • Tomcat 6 on CentOS == ERROR

Versions in the POM:

  • batik:batik:jar:1.5:compile
  • net.sf.saxon:saxon:jar:8.7:compile
  • batik:batik-transcoder:jar:1.6-1:compile
    • batik:batik-bridge:jar:1.6-1:compile
    • batik:batik-gvt:jar:1.6-1:compile
    • batik:batik-awt-util:jar:1.6-1:compile
    • batik:batik-util:jar:1.6-1:compile
    • batik:batik-gui-util:jar:1.6-1:compile
    • batik:batik-ext:jar:1.6-1:compile
    • xml-apis:xmlParserAPIs:jar:2.0.2:compile
    • batik:batik-script:jar:1.6-1:compile
    • batik:batik-svg-dom:jar:1.6-1:compile
    • batik:batik-dom:jar:1.6-1:compile
    • batik:batik-css:jar:1.6-1:compile
    • batik:batik-xml:jar:1.6-1:compile
    • batik:batik-parser:jar:1.6-1:compile
    • fop:fop:jar:0.20.5:compile
    • batik:batik-1.5-fop:jar:0.20-5:compile
    • xml-apis:xml-apis:jar:1.0.b2:compile
    • xalan:xalan:jar:2.4.1:compile
    • xerces:xercesImpl:jar:2.2.1:compile
    • avalon-framework:avalon-framework:jar:4.0:compile

Answer

Tero Pelkonen picture Tero Pelkonen · Nov 10, 2010

Thanks, this was very useful.

On Win 7 / Tomcat 6 had the exactly same "missing crimson" thing. Got it working by adding the crimson libraries, but the performance was poor, very slow. It took something like 10-15 seconds for a single image transcoding. Finally solved the problem by removing the FOP as you described, and now it is really fast. This is how it is in my POM:

    <dependency>
        <groupId>batik</groupId>
        <artifactId>batik-transcoder</artifactId>
        <version>1.6-1</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>fop</artifactId>
                <groupId>fop</groupId>
            </exclusion>
        </exclusions>
    </dependency>