Jump to content
Changes to the Jaspersoft community edition download ×

JasperViewer throws ClassCastException


Recommended Posts

By: Tony Hanratty - thanratty

JasperViewer throws ClassCastException

2006-03-14 21:22

 

I am trying to us the JasperViewer app to view a report, compiled to a .jasper and as a .jrxml with the following command line parameters

 

-XML -Fw:ReportsSample.jrxml

 

-Fw:ReportsSample.jasper

 

The first version throws an out of bounds exception on an array access in JRPrintXmlLoader.loadXML.

 

The second command parameters give me a ClassCastException in JRViewer.loadReport(JRViewer.java:1272).

 

I've traced through with a debugger and still can't figure out why this is happening. The report (a PDF) shows fine in iReports and I'm up to date on all the Jakarta libraries etc..

 

Can someone throw me a lifeline on this?

 

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: JasperViewer throws ClassCastException

2006-03-15 01:10

JasperViewer works with filled reports (JasperPrint objects), which can be either directly serialized or exported to XML. Therefore you will first need to fill your report and then open the filled report in the viewer.

 

HTH,

Lucian

 

 

By: Tony Hanratty - thanratty

RE: JasperViewer throws ClassCastException

2006-03-15 06:19

Thanks for the info - that was exactly the problem. I now fillReport and use that JasperPrint object to instance a JasperViewer and everything runs through.

 

But.... (there had to be one!)...

 

This report only contains a static text header, and a single static text in the detail, and JasperViewer complains that "The Document Has No Pages". Should it do this even for a totally static report?

 

Thanks again,

Tony.

 

 

 

By: Lucian Chirita - lucianc

RE: JasperViewer throws ClassCastException

2006-03-15 06:55

Yes, it should.

 

Read this (check the whenNoDataType attribute)

http://jasperreports.sourceforge.net/reference/index1.html#jasperReport

 

HTH,

Lucian

 

 

By: Tony Hanratty - thanratty

RE: JasperViewer throws ClassCastException

2006-03-15 07:10

You sir, are a star!

 

One quick call to setWhenNoDataType and automagically the title appears in the output PDF. Shame there isn't an option to output all sections though - not particularly usefull of course but having the option would be nice.

 

Thanks again for the help.

 

Onward & upward,

Tony.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...