By the way, this is the exception I'm getting:
[25/02/11 15:43:15:100 BRT] 0029 SystemOut O 2011-02-25 15:43:15,100
[WebContainer : 0] BSAD-ReportSampleWicket ERROR
org.apache.wicket.util.lang.Objects - Error
serializing object class
br.com.bradseg.bsad.reportsamplewicket.relatorio.presentation.pages.Resultado
[object=[Page class =
br.com.bradseg.bsad.reportsamplewicket.relatorio.presentation.pages.Resultado,
id = 2, version = 0]]
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
Unable to serialize class:
net.sf.jasperreports.engine.data.JRBeanCollectionDataSource
Field hierarchy is:
2
[class=br.com.bradseg.bsad.reportsamplewicket.relatorio.presentation.pages.Resultado,
path=2]
private java.lang.Object org.apache.wicket.MarkupContainer.children
[class=org.apache.wicket.markup.html.link.ResourceLink, path=2:linkToPdf]
private final org.apache.wicket.Resource
org.apache.wicket.markup.html.link.ResourceLink.resource
[class=org.wicketstuff.jasperreports.JRConcreteResource]
private net.sf.jasperreports.engine.JRDataSource
org.wicketstuff.jasperreports.JRResource.reportDataSource
[class=net.sf.jasperreports.engine.data.JRBeanCollectionDataSource] <-
field that is not serializable
at
org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:372)
~[wicket-1.4.15.jar:1.4.15]
at
org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:351)
~[wicket-1.4.15.jar:1.4.15]
at
org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:641)
~[wicket-1.4.15.jar:1.4.15]
Cheers,
Bruno Borges
www.brunoborges.com.br
+55 21 76727099
"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld
On Fri, Feb 25, 2011 at 4:01 PM, Bruno Borges wrote:
> Hey all,
>
> I'm trying to build a ResourceLink to a JRResource but there's a
> Serialization exception going on. Here is the snippet code:
>
> final ServletContext context = ((WebApplication)
> getApplication()).getServletContext();
> final File reportFile = new
> File(context.getRealPath("/reports/employeeReport.jasper"));
>
> final Map parameters = new HashMap();
> parameters.put("BaseDir", new File(context.getRealPath("/reports")));
> JRResource pdfResource = new JRConcreteResource(reportFile, new
> PdfResourceHandler()).setReportParameters(
> parameters).setReportDataSource(new
> JRBeanCollectionDataSource(service.listAll()));
>
> add(new ResourceLink("linkToPdf", pdfResource));
>
> The service variable is a @SpringBean.
>
> Any idea anyone? (Eelco, specially... who wrote jasper integration on
> wicketstuff)...
>
> :-)
>
> Best regards,
>
> Bruno Borges
> www.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
> - Francois de La Rochefoucauld
>
>