Jump to content
Changes to the Jaspersoft community edition download ×

ClassCastException when exporting


2005 IR Help

Recommended Posts

By: Tom Schindl - tomsontom

ClassCastException when exporting

2004-09-01 08:56

Hi,

 

I'm running into problems when I try to export my jasper-File to any format, I get the following exception:

 

--------------8<--------------

java.lang.ClassCastException: net.sf.jasperreports.engine.JasperReport

at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:104)

.....

--------------8<--------------

 

The code is the following:

--------------8<--------------

JasperCompileManager.compileReportToFile("C:\Dokumente und Einstellungen\tom-admin\Eigene Dateien\eclipsehome\biscat\src\reports\employee_basedata.jrxml");

System.out.println("It's compiled");

JasperFillManager.fillReport("C:\Dokumente und Einstellungen\tom-admin\Eigene Dateien\eclipsehome\biscat\src\reports\employee_basedata.jasper",collector.getParameters(),connection);

System.out.println("It's filled");

JasperExportManager.exportReportToPdfFile("C:\Dokumente und Einstellungen\tom-admin\Eigene Dateien\eclipsehome\biscat\src\reports\employee_basedata.jasper");

System.out.println("It's exported");

--------------8<--------------

 

I've also tried the HorizontalReport-example but I get the same exception. What am I doing wrong?

 

Tom

Link to comment
Share on other sites

  • 7 months later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Still struggling with no clue. Please help me if anyone knows what the problem is.

 

Here is my console:

java.lang.ClassCastException: net.sf.jasperreports.engine.JasperReport

at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:77)

at HelloWorldApp.main(HelloWorldApp.java:115)

 

And in the class, I am using JasperExportManager as:

 

JasperExportManager.exportReportToPdfFile(fileName);

 

The report is the as simple as:

 

<?xml version="1.0"?>

<!DOCTYPE jasperReport

PUBLIC "-//JasperReports//DTD Report Design//EN"

"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport name="Simple_Report">

<detail>

<band height="20">

<staticText>

<reportElement x="180" y="0" width="200" height="20"/>

<text><![CDATA[Hello World!]]></text>

</staticText>

</band>

</detail>

</jasperReport>

 

So I guess it has nothing to do with the file. But I am using both jasper jars and project code from 1.2.4 and it compiled fine.

 

Thanks

 

Jackie

Link to comment
Share on other sites

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...