Another question on servlet
As I have asked the similar question about servlet ,which is for showing a report on browser. I reconstruct a Danymic web project(named JasperServlet) using Eclipse,after creating . compiling and maping servlet(named FirstReportSendToBrowserServlet
) , put the servlet into Apache Tomcat v5.5
,after I fire up tomcat, open http://localhost:8080/JasperServlet/FR (FirstReportSendToBrowserServlet has mapped to FR in web.xml) , what I got puzzled me:
exception
javax.servlet.ServletException: Error instantiat开发者_开发技巧ing servlet class FirstReportSendToBrowserServlet org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) java.lang.Thread.run(Thread.java:619) root cause
java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException java.lang.Class.getDeclaredConstructors0(Native Method) java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) java.lang.Class.getConstructor0(Class.java:2699) java.lang.Class.newInstance0(Class.java:326) java.lang.Class.newInstance(Class.java:308) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) java.lang.Thread.run(Thread.java:619)
I have already find in Apache's bugzilla , But it seems that I can not find a similar answer. Do somebody can give hints?
You need jasper-reports.jar
in your WEB-INF/lib
. NoClassDefFoundError means the application expects a class to be on the classpath, but it is missing. The classpath of a web application is formed by:
- WEB-INF/classes
- WEB-INF/lib
- the container libraries
精彩评论