“未找到 SAX2 驱动程序类 org.apache.crimson.parser.XMLReaderImpl” 在 Tomcat 上的 Web 应用程序中使用 Batik 时
这可能与类路径问题有关,但我现在真的不确定,因为我在某些机器上没有收到此错误。
堆栈顶部的错误是 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
谢谢,这非常有用。
在 Win 7 / Tomcat 6 上也有完全相同的“缺少深红色”的情况。 通过添加 crimson 库让它工作,但性能很差,非常慢。 单张图像转码大约需要 10-15 秒。 最后通过按照您所描述的方式删除 FOP 解决了问题,现在速度非常快。 我的 POM 中是这样的:
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:
事实证明,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.
这是JDK版本问题。 在这里找到:
crimson
lib 并且可以正常工作显影机;使用以下 Maven 配置:
It's a JDK versions problem. Found here:
crimson
lib and works fine on developer machine;Use the following maven config: