Generate a Report with a List, Error retrieving field value from bean

0

Hello, I'm a newbe

I tried to generate a Report with Eclipse / JasperSoft Studio
 here's my code:

public void reportGenerieren(List daten, String path) throws JRException{

  JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(path);
       JasperPrint jasperPrint = JasperFillManager.fillReport(jr, null, new JRBeanCollectionDataSource(daten));
       //JasperPrintManager.printReportToPdfFile(jasperPrint, "C:\\meinePDF.pdf");
       JRPdfExporter pdf = new JRPdfExporter();
       pdf.setParameter(JRPdfExporterParameter.JASPER_PRINT, jasperPrint);
       pdf.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C:\\Temp\\test.pdf");
       pdf.exportReport();
 }

But I allways get the error: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : gueltigbis

How can I solve this problem?

Thanks for your help

silvana.maissen's picture
Joined: May 6 2013 - 9:00am
Last seen: 5 years 2 months ago

3 Answers:

2

Show your bean (daten)  and jrxml. You should check getter for "gueltigbis"

sanbez's picture
808
Joined: Jan 11 2011 - 2:06am
Last seen: 21 hours 48 min ago
0

 

Hello again

You find attached my jrxml-File, class 'Vertrag' and class 'Geraet', which contains 'gueltigbis'.

 

Thank you very much!

Attachments: 
AttachmentSize
Binary Data vertrag.jrxml16.55 KB
File geraet.java4.03 KB
File vertrag.java2.18 KB
silvana.maissen's picture
Joined: May 6 2013 - 9:00am
Last seen: 5 years 2 months ago
0

I am guess that daten is a list of geraet.

Two ways for solution:
1. Change getter for gueltigbis from "getGueltigBis()" (now) to "getGueltigbis()"  - it must match field name in jrxml (case-sensitive)
or

2 Change field "gueltigbis" to "gueltigBis" in jrxml

sanbez's picture
808
Joined: Jan 11 2011 - 2:06am
Last seen: 21 hours 48 min ago
Feedback