无效的Jasper报告定义(JRXML)

时间:2018-11-08 04:57:39

标签: jasper-reports

嗨,我是碧玉报告的初学者,我得到了一个错误,这个下面的变量出现错误,我得到了这个错误

- net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($V{Variable_4_1}                                                                     .split(",")[$V{a}] != "" && $V{Variable_4_1}.split(",")[$V{a}] != null ? ($V{Variable_4_1}.split(",                                                                     ")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/")[1] + "/" + $V{Variabl                                                                     e_4_1}.split(",")[$V{a}].split("/")[0]) : " - ") +
" - " +
($V{Variable_4_1_2}.split(",")[$V{a}] != "" && $V{Variable_4_1_2}.split(",")[$V{a}] != null ? ($V{Variable_4_1_2}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("                                                                     /")[1] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("/")[0]) : " - ")
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($V{Variable_4_1}.split(",")[$V{a}] != "" && $V{Variable_4_1}.split(",")[$V{a}] != null ? ($V                                                                     {Variable_4_1}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/"                                                                     )[1] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/")[0]) : " - ") +
" - " +
($V{Variable_4_1_2}.split(",")[$V{a}] != "" && $V{Variable_4_1_2}.split(",")[$V{a}] != null ? ($V{Variable_4_1_2}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("                                                                     /")[1] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("/")[0]) : " - ")
        at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:264)
        at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:610)
        at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:578)
        at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:101                                                                     5)
        at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:572)
        at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:556)
        at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.                                                                     java:258)
        at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:454)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2                                                                     029)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:755)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.jav                                                                     a:282)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:126)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
        at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:393)
        at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:91)
        at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)
        at org.joget.plugin.enterprise.JasperReportsMenu.getReport_aroundBody72(JasperReportsMenu.j                                                                     ava:365)
        at org.joget.plugin.enterprise.JasperReportsMenu.getReport_aroundBody73$advice(JasperReport                                                                     sMenu.java:94)
        at org.joget.plugin.enterprise.JasperReportsMenu.getReport_aroundBody74(JasperReportsMenu.j                                                                     ava:1)
        at org.joget.plugin.enterprise.JasperReportsMenu.getReport_aroundBody75$advice(JasperReport                                                                     sMenu.java:45)
        at org.joget.plugin.enterprise.JasperReportsMenu.getReport(JasperReportsMenu.java:1)
        at org.joget.plugin.enterprise.JasperReportsMenu.generateReport_aroundBody80(JasperReportsM                                                                     enu.java:439)
        at org.joget.plugin.enterprise.JasperReportsMenu.generateReport_aroundBody81$advice(JasperR                                                                     eportsMenu.java:94)
        at org.joget.plugin.enterprise.JasperReportsMenu.generateReport_aroundBody82(JasperReportsM                                                                     enu.java:1)
        at org.joget.plugin.enterprise.JasperReportsMenu.generateReport_aroundBody83$advice(JasperR                                                                     eportsMenu.java:45)
        at org.joget.plugin.enterprise.JasperReportsMenu.generateReport(JasperReportsMenu.java:1)
        at org.joget.plugin.enterprise.JasperReportsMenu.webService_aroundBody56(JasperReportsMenu.                                                                     java:223)
        at org.joget.plugin.enterprise.JasperReportsMenu.webService_aroundBody57$advice(JasperRepor                                                                     tsMenu.java:94)
        at org.joget.plugin.enterprise.JasperReportsMenu.webService_aroundBody58(JasperReportsMenu.                                                                     java:1)
        at org.joget.plugin.enterprise.JasperReportsMenu.webService_aroundBody59$advice(JasperRepor                                                                     tsMenu.java:45)
        at org.joget.plugin.enterprise.JasperReportsMenu.webService(JasperReportsMenu.java:1)
        at org.joget.apps.app.controller.PluginJsonController.pluginService(PluginJsonController.ja                                                                     va:186)
        at sun.reflect.GeneratedMethodAccessor359.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod                                                                     (HandlerMethodInvoker.java:177)
        at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHand                                                                     lerMethod(AnnotationMethodHandlerAdapter.java:446)
        at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(Ann                                                                     otationMethodHandlerAdapter.java:434)
        at org.joget.commons.spring.web.ParameterizedAnnotationMethodHandlerAdapter.handle(Paramete                                                                     rizedAnnotationMethodHandlerAdapter.java:32)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:96                                                                     6)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:291)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.owasp.csrfguard.CsrfGuardFilter.doFilter(CsrfGuardFilter.java:59)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:316)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(Filte                                                                     rSecurityInterceptor.java:126)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(Fil                                                                     terSecurityInterceptor.java:90)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTra                                                                     nslationFilter.java:114)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagem                                                                     entFilter.java:122)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(A                                                                     nonymousAuthenticationFilter.java:111)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCa                                                                     cheAwareFilter.java:48)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.d                                                                     oFilter(AbstractAuthenticationProcessingFilter.java:205)
        at org.joget.apps.workflow.security.WorkflowHttpAuthProcessingFilter.doFilter(WorkflowHttpA                                                                     uthProcessingFilter.java:85)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterIn                                                                     ternal(BasicAuthenticationFilter.java:158)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:1                                                                     07)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.d                                                                     oFilter(AbstractAuthenticationProcessingFilter.java:205)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilte                                                                     r.java:120)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriter                                                                     Filter.java:64)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:1                                                                     07)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.                                                                     doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:1                                                                     07)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(Secur                                                                     ityContextPersistenceFilter.java:91)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChai                                                                     nProxy.java:330)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java                                                                     :213)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProx                                                                     y.java:344)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java                                                                     :261)
        at org.joget.commons.spring.web.CustomDelegatingFilterProxy.doFilter(CustomDelegatingFilter                                                                     Proxy.java:30)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.joget.apps.app.web.ExpireFilter.doFilter(ExpireFilter.java:43)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.joget.apps.app.web.JsonResponseFilter.doFilter(JsonResponseFilter.java:138)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodin                                                                     gFilter.java:85)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:1                                                                     07)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.                                                                     java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206                                                                     )
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:318)
        at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:194)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:10                                                                     86)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.ja                                                                     va:659)
        at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProt                                                                     ocol.java:223)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod$MyPojoMetaMethodSi                                                                     te.call(ObjectArrayGetAtMetaMethod.java:60)

我从这个特定的表达中得到了这个。请帮助我,我真的没有得到错误的含义。对于这个错误,我将不胜感激,谢谢。我一直在花时间解决这个问题,但还是没有运气。

Cause:
Error evaluating expression for source text: ($V{Variable_4_1}.split(",")[$V{a}] != "" && $V{Variable_4_1}.split(",")[$V{a}] != null ? ($V{Variable_4_1}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/")[1] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/")[0]) : " - ") + " - " + ($V{Variable_4_1_2}.split(",")[$V{a}] != "" && $V{Variable_4_1_2}.split(",")[$V{a}] != null ? ($V{Variable_4_1_2}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("/")[1] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("/")[0]) : " - ")

1 个答案:

答案 0 :(得分:0)

这是由ArrayIndexOutOfBoundsException引起的(请参阅堆栈跟踪的底部)。 在您计算变量的某个位置,您将访问一个不存在的值数组。

它应该在这里的某个地方发生。请检查此代码

[$V{a}] or [2] or even [0]

这似乎太复杂且冗长的代码,也许您应该考虑将其拆分为多个变量):

($V{Variable_4_1}.split(",")[$V{a}] != "" && $V{Variable_4_1}.split(",")[$V{a}] != null ? ($V{Variable_4_1}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/")[1] + "/" + $V{Variable_4_1}.split(",")[$V{a}].split("/")[0]) : " - ") + " - " + ($V{Variable_4_1_2}.split(",")[$V{a}] != "" && $V{Variable_4_1_2}.split(",")[$V{a}] != null ? ($V{Variable_4_1_2}.split(",")[$V{a}].split("/")[2] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("/")[1] + "/" + $V{Variable_4_1_2}.split(",")[$V{a}].split("/")[0]) : " - ")

因为我不知道您要在变量中输入什么值,所以我只能猜测错误发生的位置,但是我建议使用笔和纸运行这段代码以查看会发生什么。