本文主要是介绍javax.servlet.ServletException: java.lang.NoClassDefFoundError:,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
楼主使用Apache POI把word转成HTML,是遇到一个问题;
同一个项目里面单独使用test.java调用POI可以吧word转成HTML,但是放到action中或者在JSP文件里面调用是就会出错
type Exception report
message javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/hwpf/converter/PicturesManager
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/hwpf/converter/PicturesManager
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/hwpf/converter/PicturesManager
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:905)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:834)
org.apache.jsp.test_jsp._jspService(test_jsp.java:107)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.NoClassDefFoundError: org/apache/poi/hwpf/converter/PicturesManager
org.apache.jsp.test_jsp._jspService(test_jsp.java:95)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.ClassNotFoundException: org.apache.poi.hwpf.converter.PicturesManager
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1333)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1180)
org.apache.jsp.test_jsp._jspService(test_jsp.java:95)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.8 logs.
错误的原因其实是:org/apache/poi/hwpf/converter/PicturesManager所在的jar包虽然build path,
但是Tomcat8.0\webapps\项目名\WEB-INF\lib文件夹下面没有对应jar包(原因楼主也不懂)
解决方法:把对应的包拷贝到Tomcat8.0\webapps\项目名\WEB-INF\lib
这篇关于javax.servlet.ServletException: java.lang.NoClassDefFoundError:的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!