无法编译JasperReports的webapp示例 [英] Cannot compile webapp sample of JasperReports

查看:108
本文介绍了无法编译JasperReports的webapp示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次在官方发行版中运行JasperReports的webapp示例。
我将jar中的\dist和\ lib放入webapp示例中,并将webapp-sample的整个目录部署到tomcat中。
但是当我尝试使用默认页面编译WebappReport.jrxml时,我看到一个error.jsp,它显示以下提示:

It's my first time to run the the webapp sample of the JasperReports in the offical distribution. I put the jar in the \dist and \lib into the webapp sample and deployed the whole dir of the webapp-sample into tomcat. But when I try to use the default page to compile the WebappReport.jrxml, I see an error.jsp, and it shows me the following prompt:

JasperReports遇到此错误:

JasperReports encountered this error :

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. scriptlets.WebappScriptlet cannot be resolved to a type
                value = ((scriptlets.WebappScriptlet)((scriptlets.WebappScriptlet)parameter_REPORT_SCRIPTLET.getValue())).hello(); //$JR_EXPR_ID=23$
                          <------------------------>
2. scriptlets.WebappScriptlet cannot be resolved to a type
                value = ((scriptlets.WebappScriptlet)((scriptlets.WebappScriptlet)parameter_REPORT_SCRIPTLET.getValue())).hello(); //$JR_EXPR_ID=23$
                                                       <------------------------>
3. scriptlets.WebappScriptlet cannot be resolved to a type
                value = ((scriptlets.WebappScriptlet)((scriptlets.WebappScriptlet)parameter_REPORT_SCRIPTLET.getValue())).hello(); //$JR_EXPR_ID=23$
                          <------------------------>
4. scriptlets.WebappScriptlet cannot be resolved to a type
                value = ((scriptlets.WebappScriptlet)((scriptlets.WebappScriptlet)parameter_REPORT_SCRIPTLET.getValue())).hello(); //$JR_EXPR_ID=23$
                                                       <------------------------>
5. scriptlets.WebappScriptlet cannot be resolved to a type
                value = ((scriptlets.WebappScriptlet)((scriptlets.WebappScriptlet)parameter_REPORT_SCRIPTLET.getValue())).hello(); //$JR_EXPR_ID=23$
                          <------------------------>
6. scriptlets.WebappScriptlet cannot be resolved to a type
                value = ((scriptlets.WebappScriptlet)((scriptlets.WebappScriptlet)parameter_REPORT_SCRIPTLET.getValue())).hello(); //$JR_EXPR_ID=23$
                                                       <------------------------>
6 errors

at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:191)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:212)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:128)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:87)
at org.apache.jsp.jsp.compile_jsp._jspService(compile_jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
at java.lang.Thread.run(Thread.java:619)


推荐答案

这是由于一个错误(在我们的例子中是JasperServer),JDT编译器正在编译从缓存加载的报告缺少类路径上的scriptlet。最初运行报表时不会发生这种情况,因为在这种情况下,JDT评估程序(而不是编译器)与类路径上的scriptlet一起使用。换句话说:

This is due to a bug (in our case in JasperServer) where a report loaded from cache is being compiled by the JDT compiler is missing the scriptlet on the classpath. This does not happen when the report is run initially because in that case the JDT evaluator (instead of the compiler) is used with the scriptlet on the classpath. In other words:


  1. 使用JDT评估程序运行报告,将scriptlet添加到类路径中

  2. 报告是从缓存加载并使用JDT编译器编译的,没有类路径上的scriptlet(因为JDT编译器与包含应用程序共享其类路径,与具有自己的类路径的赋值器相反)。

快速解决方法是将scriptlet添加到包含应用程序的类路径中。

The quick fix is to add the scriptlet to your containing application's classpath.

这篇关于无法编译JasperReports的webapp示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆