“未找到 SAX2 驱动程序类 org.apache.crimson.parser.XMLReaderImpl” 在 Tomcat 上的 Web 应用程序中使用 Batik 时

发布于 2024-07-16 06:52:54 字数 1303 浏览 13 评论 0原文

这可能与类路径问题有关,但我现在真的不确定,因为我在某些机器上没有收到此错误。

堆栈顶部的错误是 SAX2 驱动程序类 org.apache.crimson.parser.XMLReaderImpl 未找到。 为什么我只在某些环境中出现此错误,而在其他环境中则不会? 我如何进一步调查和/或解决这个问题?

环境:

  • Mac 或 PC 上的 Jetty == OK
  • Mac 上的 Tomcat 5 或 6 == OK
  • Win XP 上的 Tomcat 5 或 6 == 错误
  • CentOS 上的 Tomcat 6 == 错误

POM 中的版本:

  • batik:batik:jar:1.5:编译
  • net.sf.saxon:saxon:jar:8.7:编译
  • batik:batik-transcoder:jar:1.6-1:编译
    • 蜡染:蜡染桥:jar:1.6-1:编译
    • 蜡染:蜡染-gvt:jar:1.6-1:编译
    • 蜡染:batik-awt-util:jar:1.6-1:编译
    • 蜡染:蜡染-util:jar:1.6-1:编译
    • 蜡染:batik-gui-util:jar:1.6-1:编译
    • 蜡染:蜡染-ext:jar:1.6-1:编译
    • xml-apis:xmlParserAPIs:jar:2.0.2:编译
    • 蜡染:蜡染脚本:jar:1.6-1:编译
    • 蜡染:batik-svg-dom:jar:1.6-1:编译
    • 蜡染:蜡染-dom:jar:1.6-1:编译
    • 蜡染:蜡染-css:jar:1.6-1:编译
    • 蜡染:蜡染-xml:jar:1.6-1:编译
    • 蜡染:蜡染解析器:jar:1.6-1:编译
    • fop:fop:jar:0.20.5:编译
    • 蜡染:batik-1.5-fop:jar:0.20-5:编译
    • xml-apis:xml-apis:jar:1.0.b2:编译
    • xalan:xalan:jar:2.4.1:编译
    • xerces:xercesImpl:jar:2.2.1:编译
    • avalon-framework:avalon-framework:jar:4.0:compile

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

儭儭莪哋寶赑 2024-07-23 06:52:54

谢谢,这非常有用。

在 Win 7 / Tomcat 6 上也有完全相同的“缺少深红色”的情况。 通过添加 crimson 库让它工作,但性能很差,非常慢。 单张图像转码大约需要 10-15 秒。 最后通过按照您所描述的方式删除 FOP 解决了问题,现在速度非常快。 我的 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>

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>
嘿看小鸭子会跑 2024-07-23 06:52:54

事实证明,Apache XML Graphics 本身将 Crimson 添加到类路径中两次。 一次在 Apache Batik 转码器中,一次在 Apache FOP 中。

由于 Tomcat 中的库是按字母顺序加载的,因此 FOP 首先包含 Crimson,然后 Batik 也做了同样的事情。

我从项目 POM 中排除了 FOP,并解决了类路径问题。

It turns out that Apache XML Graphics itself adds Crimson to the classpath, twice. Once in the Apache Batik transcoder, and once in Apache FOP.

Since the libs are loaded alphabetically in Tomcat, FOP included Crimson, first, but then Batik also did the same.

I excluded FOP from the project POM, and have resolved the classpath issue.

櫻之舞 2024-07-23 06:52:54

这是JDK版本问题。 在这里找到

  • 一些 JDK 已经包含 crimson lib 并且可以正常工作显影机;
  • 但有些 JDK 在用户的机器上没有该库并抛出错误;

使用以下 Maven 配置:

<dependency>
    <groupId>batik</groupId>
    <artifactId>batik-transcoder</artifactId>
    <version>1.6-1</version>
</dependency>
<dependency>
    <groupId>crimson</groupId>
    <artifactId>crimson</artifactId>
    <version>1.1.3</version>
</dependency>

It's a JDK versions problem. Found here:

  • Some JDK already include crimson lib and works fine on developer machine;
  • But some JDK haven't that lib on user's machines and throw error;

Use the following maven config:

<dependency>
    <groupId>batik</groupId>
    <artifactId>batik-transcoder</artifactId>
    <version>1.6-1</version>
</dependency>
<dependency>
    <groupId>crimson</groupId>
    <artifactId>crimson</artifactId>
    <version>1.1.3</version>
</dependency>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文