Jump to content
We've recently updated our Privacy Statement, available here ×

james.kranz

Members
  • Posts

    1
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by james.kranz

  1. Hello all, TL;DR: I want to have the names of all participants of an event. I create reports using JavaBeans and Jaspersoft Studio. The structure of my objects looks like this: Event.allSubevents (java.util.List) Subevent.allRegistrations (java.util.List) Registration.Participant (DataModel.Participant) I'm using the list component to display all subevents and a subreport to display a list of registrations. During report generation I get a ClassCast Excpetion with the following form: Caused by: java.lang.ClassCastException: DataModel.Participant cannot be cast to DataModel.Participant[/code]I suspect it's a problem involving classloaders. What can I do? I have already tried setting the classloader of the subreport by using the REPORT_CLASS_LOADER and REPORT_CONTEXT parameters. Long version: I'm having problems generating a report using a collection of JavaBeans. I want to display properties of objects which are inside of a java.util.List, which is nested inside a JavaBean which is also nested inside another java.util.List. I can access the first list and it's elements using the "list" component without problems. But I've found out, that it's not possible to generate a datasource from elements inside a list component in order to display the second nested list. As a workoaround I thought of using a subreport inside the list component which displays the list elements. This subreport would get the list as datasource by using the datasource expression: "new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listProperty})"[/code]So far, so good. The targeted property is itself a list containing registrations which are associated with the participants. The ultimate goal is to get the names of them. When I try to fill the report a ClassCast Exception occurs. The stack trace is as follows: net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $F{participant} at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:548) at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$20(ReportControler.java:523) at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:404) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)[...]Caused by: java.lang.ClassCastException: DataModel.Participant cannot be cast to DataModel.Participant at ClassLoading_sub_ListOfRegistrations_1488207711822_474221.evaluate(ClassLoading_sub_ListOfRegistrations_1488207711822_474221:171) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:276) ... 27 more[/code]I suspect that this a sign that two different classloaders are used. I have already tried setting the classloader of the subreport excplicitly with the help of the REPORT_CLASS_LOADER and REPORT_CONTEXT parameters but not luck so far. What can I do?
×
×
  • Create New...