JasperReports accessing to property javabeans

I´m studying jasperreports and I want access to property subclass for example Report.Persona.name but jasperreport show me this error:

net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : name
Caused by: java.lang.NoSuchMethodException: Unknown property 'name' on class 'class com.test.dto.Report'

I´m trying accessing by

but show other errors.

I have 3 DTO class


public class Person {

   private int id;
   private String name;
   private String lastname;
   private String age;
   ...getter setter


public class Ticket {

   private int number;
   private String typeTicket;
   private String dateTicket;
   ...getter setter

and this class that group both last class


public class Report {

   private Person person;
   private List<Ticket> ticket;
   ...getter setter

A main class to call my collection(Report) and send to parameter with JRBeanCollectionDataSource


public class Main {

public static void main(String[] args) throws FileNotFoundException, JRException {

    JasperDesign jasperDesign;
    JasperPrint jasperPrint;
    JasperReport jasperReport;

        InputStream base = new FileInputStream(new File("C:\\Users\\Documents\\NetBeansProjects\\TestReport\\src\\jrxml\\Template.jrxml"));

        jasperDesign = JRXmlLoader.load(base);
        jasperReport = JasperCompileManager.compileReport(jasperDesign);

        jasperPrint = JasperFillManager.fillReport(jasperReport, null,
                new JRBeanCollectionDataSource(
        //view the report using JasperViewer
    catch (JRException e)


private static Collection getMyData()

    List<Report> data = new LinkedList<Report>();
    Report report = new Report();

    Person p1 = new Person();
    p1.setName("My Name ");
    p1.setLastName("Last Name");



    // .... comment code to List<Ticket>
    return data;



Well, the way Jasper-Reports deals with bean properties, is reading them as parameters. An you just have to create a Map object to store them. For example, inside your Java code (in Main class, as there is the code you use to generate the report) you have to put this snippet :

Map parameters = new HashMap();
String name = Report.person.getName();
parameters.put("name", name);

jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JRBeanCollectionDataSource(

This way, the person's name stored in Report class, will be visible to the jrxml of the report. Now, the second step is to use this parameter in the report, by an expression like:


And that is all you need.

Need Your Help

Restricting speech recognition results on Android

java android speech-recognition

I'm making an app that allows people to speak and select between a few options (Strings). I'm having a little problem making the Android Speech Recognizer fit my idea.

How Google API V 3.0 .Net library and Google OAuth2 Handling refresh token

c# google-api google-calendar-api google-oauth google-api-dotnet-client

In my application I am using Google API V 3.0 .Net library with Google OAuth2 to synchronize Google calender and outlook calender. I am using below code to get the Google.Apis.Calendar.v3.CalendarS...