我目前有一个类Reporter.java,它使用JasperReports生成HTML报告。我有一个简单的Test.java调用Reporter.report(),HTML文件在指定的文件位置正确生成(我目前将它设置为指向我的Tomcat项目的C:/路径)。现在,我运行一个带有HTML页面的Tomcat服务器,该页面调用调用Reporter.report()的generateStatus.jsp并抛出异常。
Jun 30, 2011 3:02:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/OATS] threw exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JasperCompileManager] with root cause
java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JasperCompileManager
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at com.home.oats.Reporter.report(Reporter.java:22)
at org.apache.jsp.generateStatus_jsp._jspService(generateStatus_jsp.java:58)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
它出错的行是
JasperReport jasperReport = JasperCompileManager.compileReport(jasper.getString(Constants.JRXML));
有什么建议吗?
谢谢你的时间!
答案 0 :(得分:0)
您的网络应用的WEB-INF/lib
目录中似乎缺少Jasper Jar文件。
答案 1 :(得分:0)
这是一个很好的例子:
http://codebackup.wordpress.com/2008/02/29/howto-jasperreports-framework-deployment-to-tomcat/
但我仍然希望在目录中生成报告的“转储”,而不是在单个HTML页面上显示报告。