peterlongo Posted November 14, 2006 Share Posted November 14, 2006 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 More sharing options...
lucianc Posted November 14, 2006 Share Posted November 14, 2006 Is this reproducible outside the Jboss/Tomcat environment, i.e. in a simple Java application? Regards,Lucian Link to comment Share on other sites More sharing options...
peterlongo Posted November 14, 2006 Author Share Posted November 14, 2006 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 parameterif (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 More sharing options...
lucianc Posted November 14, 2006 Share Posted November 14, 2006 This is a bug which occurs when JRImageMapRenderer is used in conjunction with JRHtmlExporterParameter.IMAGES_MAP (the name resemblance is misleading, the two are not related). It's now fixed on SVN rev 1484. Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now