在iReport Designer中,我创建了一个名为address
的字段,其类型为java.lang.Object
,我创建了一个Text
,其表达式为$F{address}.text
。 address
的数据是java.util.Map
,看起来像这样:
["bldgname":null, "barangay":["name":"MINAULON", "objid":"057-01-0013"], "province":"LANAO DEL NORTE", "text":"MINAULON, BACOLOD, \nLANAO DEL NORTE", "unitno":null, "type":"local", "bldgno":null, "pin":null, "city":null, "subdivision":null, "municipality":"BACOLOD", "street":null]
预览报告后,抛出错误说:
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $F{address}.text
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:197)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:537)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:505)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:826)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:368)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:353)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:275)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:426)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:311)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:247)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:879)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:801)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
at com.rameses.osiris2.reports.ReportModel$JReportInfo.fillReport(ReportModel.java:329)
at com.rameses.osiris2.reports.ReportModel.createReport(ReportModel.java:163)
at com.rameses.osiris2.reports.ReportModel.viewReport(ReportModel.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:777)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:757)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:195)
at WaterworksAccountBill.viewReport(com.rameses.gov.etracs.waterworks.models.WaterworksAccountBill:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:665)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
at WaterworksAccountBill.invokeMethod(com.rameses.gov.etracs.waterworks.models.WaterworksAccountBill)
at com.rameses.custom.impl.MethodResolverImpl.invoke(MethodResolverImpl.java:27)
at com.rameses.rcp.util.ControlSupport.invoke(ControlSupport.java:123)
at com.rameses.osiris2.client.WorkUnitUIController.init(WorkUnitUIController.java:163)
at com.rameses.rcp.util.ControlSupport.initOpener(ControlSupport.java:221)
at com.rameses.rcp.util.ControlSupport.initOpener(ControlSupport.java:182)
at com.rameses.rcp.impl.NavigationHandlerImpl.navigate(NavigationHandlerImpl.java:39)
at com.rameses.rcp.util.UICommandUtil.processAction(UICommandUtil.java:115)
at com.rameses.rcp.control.XButton.actionPerformed(XButton.java:284)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
at java.awt.Component.processMouseEvent(Component.java:6288)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6053)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4651)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: groovy.lang.MissingPropertyException: No such property: text for class: com.rameses.osiris2.reports.ReportDataSource
如何解决此问题?我使用Groovy
作为语言。
答案 0 :(得分:1)
错误说
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $F{address}.text
...
Caused by: groovy.lang.MissingPropertyException: No such property: text for class: com.rameses.osiris2.reports.ReportDataSource
似乎$ F {address}不是java.util.Map实例,而是com.rameses.osiris2.reports.ReportDataSource对象。
仔细检查数据源中字段的类型。