This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Error with JasperExportManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Error with JasperExportManager" Watch "Error with JasperExportManager" New topic
Author

Error with JasperExportManager

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Hello !

When I use
JasperExportManager.exportReportToXmlFile("classic.jasper", true)
method I am getting following error,

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

However it is generating .jrprint file, but nothing is getting printed.

How to solve this?

Thanks in advance.

Reg,
Chetan


My blood is tested +ve for Java.
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
Before exporting the report to either xml or excel sheet, you are required
to fill the report with the data.
Ideally speaking below mentioned are the steps in sequence:

1. Compile the .jrxml/.xml file to generate the jasper file
2. Fill the report by passing the .jasper file as a parameter
3. Export to desired report format by passing the .jrprint file as a
parameter and not the .jasper file (thatz why, ClassCastException)

If you are still confused,as i mentioned earlier please check the jasper
report samples. Open one of the build.xml file. u'll know when to use which
file.

Regards,
Sangeetha
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Hi

Thx for replying but I have code same manner as you wrote.

See this.....



Let me know if something is wrong it the code.

Thx in advance.

Reg,
Chetan
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
hi,

try this!!!
JasperPrintManager.printReport("classic1.jrprint", true);
instead of passing the .jasper file...
Guess this shud work.

Please let me know the result.

Regards,
Sangeetha
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Hi Sangeetha!

Thx for reply. It is working now.

I was really runing sort of time and your ans was very cruise for me.

Thanks and Regards,
Chetan Parekh
san geetha
Ranch Hand

Joined: Sep 07, 2004
Posts: 44
Glad, u got it rite.

Earlier i had posted a question titled
Jasper Reports - HyperLink
Please read the same and see if u can help me.

Thanks,
Sangeeta
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Hi!

Sorry we were on company workshop last week.

Hey you can check following forum...
http://sourceforge.net/forum/forum.php?forum_id=113530

I seen similar req as you over there.

It might be helpful to you.

Reg,
Chetan
 
 
subject: Error with JasperExportManager
 
Similar Threads
error while opening mock exam
XML Schema Error
ant is not working
Tomcat Error
cannot find the declaration of element taglib