我不确定问题出在 apache 服务器还是蜡染上。我正在尝试使用 servlet 中的 Batik 将 svg 转换为 java 中的图像。当我在 servlet 中实例化 SVGConverter
SVGConverter svgConverter = new SVGConverter()
Apache 返回此错误:
Jun 26, 2012 3:28:10 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [FCImg] in context with path [/jsp_batik] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoClassDefFoundError: org/apache/batik/apps/rasterizer/SVGConverter
at FCImg.doPost(FCImg.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
我在项目中包含了正确的 jar 文件,并且在编译实例化 SVGConverter 对象的 java 文件时似乎没有任何错误。
任何建议都有帮助,谢谢!
编辑:我只需要在 WEB-INF/lib 文件夹中包含必要的 jar 文件(所有蜡染 jar 文件)。