croutledge Posted May 6, 2009 Share Posted May 6, 2009 I'm using fields pulled into the report using a JavaBean DataSource.So i put in the full path of the Bean and it pulls the fields that i can choose from into the available fields menu.Now if i just then do a preview of the report, nothing added to it, i get the following error: -Error filling print... Error retrieving field value from bean : currentPalletLocationnet.sf.jasperreports.engine.JRException: Error retrieving field value from bean : currentPalletLocation at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:123) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:100) at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:104) at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:807) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:771) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1413) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:111) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:899) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:821) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:628) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:544) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:921) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1132) at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686) at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:115) ... 14 more The code in the getter part of that attribute on the bean is as follows: -// begin-user-codeif (getCurrentPalletLocationList().isEmpty()) { return new PalletLocation();} else { return getCurrentPalletLocationList().iterator().next();}// end-user-codeSo it will be returning an empty PalletLocation i guess.Even when i used that field on the report and amend it to call the correct getters on the attributes to return a String, Integer or whatever i still get the error. So the report won't compile i guess.Is there someway of getting around this because when i do pass it a list of my data these will be filled in and not null and even then you can choose for the report to display empty when it is null. So it seems like a problem reading the getters of the fields of added to the report.Any help is much appreciated.Carl Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted May 6, 2009 Share Posted May 6, 2009 you are getting an InvocationTargetException.An InvocationTargetException is thrown when a constructor called through Constructor.newInstance(), or a method called through Method.invoke()throws an exception. The InvocationTargetException encapsulates the thrown exception, which can be retrieved using getTargetException().Try to add a try/catch in your getCurrentPalletLocation method, print it and you'll see where the problem is.Giulio Link to comment Share on other sites More sharing options...
croutledge Posted May 7, 2009 Author Share Posted May 7, 2009 This seems weird. I put some try catch in the code and added the field to the available fields in the report and it seemed to preview just fine. So i added the actual field to the report and called the appropriate get inside it to access the object data and it previewed just fine. So i removed the try catch code from the class and it still worked...strange. Link to comment Share on other sites More sharing options...
petruch Posted November 16, 2009 Share Posted November 16, 2009 I get the same error. I just ignore it, put the .jasper in the Java application and it works just fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now