Jump to content
JasperReports Library 7.0 is now available ×

JRHtmlExporter: Class cast exception


peterlongo

Recommended Posts

When executing a report containing a chart I get a class cast exception:

 

java.lang.ClassCastException

at net.sf.jasperreports.engine.export.JRHtmlExporter.exportImage(JRHtmlExporter.java:1484)

at net.sf.jasperreports.engine.export.JRHtmlExporter.exportGrid(JRHtmlExporter.java:760)

at net.sf.jasperreports.engine.export.JRHtmlExporter.exportPage(JRHtmlExporter.java:673)

at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReportToWriter(JRHtmlExporter.java:632)

at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReport(JRHtmlExporter.java:328)

 

I looked at the JRHtmlExporter.java code, it seems a test is done on a renderer object to see if it is an instance of JRImageMapRenderer. The result is that the object is really a JRImageMapRenderer object but then, when a JRImageMapRenderer cast is done, the cast fails.

 

I use jasperreport 1.2.7 in a Jboss/Tomcat 3.2.5 + jvm 1.4.2 environment.

 

Any ideas?

 

Thanks.

 

Andrea

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I tried the report with iReport 1.2.7/Html mode and there it works correctly (no class cast exception).

 

In the meanwhile I investigated further the problem in JBoss/Tomcat with a debugger and I saw the method call follows the following flow:

 

//backward compatibility with the IMAGE_MAP parameter

if (imageNameToImageDataMap != null)

{

if (renderer.getType() == JRRenderable.TYPE_SVG)

{

renderer =

new JRWrappingSvgRenderer(

renderer,

new Dimension(image.getWidth(), image.getHeight()),

image.getBackcolor()

);

}

imageNameToImageDataMap.put(imageName, renderer.getImageData());

}

//END - backward compatibility with the IMAGE_MAP parameter.

 

It is there where the renderer change from an instanceof JRImageMapRenderer to an instance of something else.

Then, as imageMapRenderer is still = true, the flow enter the if(imageMapRenderer) with the cast causing the error.

 

I am still investigating why such a flow has been followed.

 

Any suggestion?

 

Thank for your help.

 

Andrea

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