yamanko Posted November 3, 2011 Share Posted November 3, 2011 ClassCastException was throw when run JRXML report in JR 4.1.2.3, this JRXML report is designed by JR 3.7.1, and no double type field or variable in the whole report, and this report is exported to PDF successfully in JR 3.7.1, but got below error in JR 4.1.2.3. does anyone met similar error?i checked the variables in this report, if i remove all variables whose calculation is SUM or AVERAGE, this report can be run in 412 successfully too. confused!! does that mean field type is changed to double from BigDecimal when SUM or AVERAGE this field?Exception in thread "main" java.lang.ClassCastException: java.lang.Double cannot be cast to java.math.BigDecimal at net.sf.jasperreports.engine.fill.JRBigDecimalSumIncrementer.increment(JRBigDecimalIncrementerFactory.java:303) at net.sf.jasperreports.engine.fill.JRAbstractExtendedIncrementer.increment(JRAbstractExtendedIncrementer.java:42) at net.sf.jasperreports.engine.fill.JRCalculator.estimateVariables(JRCalculator.java:182) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:833) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1439) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:903) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:813) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) Link to comment Share on other sites More sharing options...
yamanko Posted November 4, 2011 Author Share Posted November 4, 2011 seems JR371 version treat field or variable as BigDecimal, while 4123 or 413 treat them as Double..uhm... Link to comment Share on other sites More sharing options...
yamanko Posted November 4, 2011 Author Share Posted November 4, 2011 371 codeClass typeClass = getTypeClass(type); Object javaValue; try { javaValue = Context.jsToJava(value, typeClass); } 4123 codeObject javaValue; try { javaValue = Context.jsToJava(value, Object.class); } Link to comment Share on other sites More sharing options...
yamanko Posted December 13, 2011 Author Share Posted December 13, 2011 still have this class cast error in latest JR version 4.5.0 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