Jump to content
We've recently updated our Privacy Statement, available here ×

classcast error [double to BigDecimal] in JR 4.1.2.3


yamanko

Recommended Posts

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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

371 code

Class typeClass = getTypeClass(type);
        Object javaValue;
        try
        {
            javaValue = Context.jsToJava(value, typeClass);
        }

 

4123 code

Object javaValue;
        try
        {
            javaValue = Context.jsToJava(value, Object.class);
        }

Link to comment
Share on other sites

  • 1 month later...

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