ClassNotFoundException when loading object

0
By: dfailla - d_failla
ClassNotFoundException when loading object
2006-05-05 07:44
I am using the code below to load a compiled jasper file in the JDeveloper environment. It will run properly the first time, but when trying to load again to service a second request, a ClassNotFoundException will be thrown from the loadObject() method. The source of the problem seems to be in the deserialization of contained classes in the report such as JRBaseLine, JRBaseRectangle. Any ideas why the exception? It sees all classes the first time through.

File reportFile = new File("C:\\WS_examples\\dodimrcat1.jasper");
JasperReport jasperReport = null;
try
{
jasperReport = (JasperReport) JRLoader.loadObject (reportFile.getPath());
System.out.println("Got compiled report");
} catch(JRException jrExp){
jrExp.printStackTrace();
}

return(jasperReport);





By: develito - devel2k5
RE: ClassNotFoundException when loading objec
2006-05-05 20:01
Hi..
How do you display the report..???
Are you using a JRViewer??

Because I had a similar problem with a Web Application made in jDeveloper.. When the report was called by the first time the report was OK.. but the second time the report don´t work.. And this was happening because the report was visualized in a JasperViewer.. like this :

(new JasperViewer()).viewReport( Myjasperprint);

Then, in view of the mistake.. I change the viewer calling for this:

(new JasperViewer()).viewReport( Myjasperprint, false);

Look the 'false' parameters.. this parameter is for when the windows report in closed it simply hide and not exit..

I hope this help you..
___________________________
PD: Sorry for may English..
2006 IR Open Dicussion's picture
Joined: Aug 10 2006 - 3:24am
Last seen: 13 years 4 months ago

0 Answers:

No answers yet
Feedback
randomness