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



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



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

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




The code is the following:


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");



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



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:




The report is the as simple as:


<?xml version="1.0"?>

<!DOCTYPE jasperReport

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



<jasperReport name="Simple_Report">


<band height="20">


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

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






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.





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