Jump to content
Changes to the Jaspersoft community edition download ×

ClassCastException in making Chart(Urgent!!! THX)


arthur17

Recommended Posts

I got this error msg below when I use iReport 0.4.0. I also post the java file and the xml file at the end

 

Filling report... Error filling print... java.lang.ClassCastException at Finding_Nemo.evaluate(Finding_Nemo.java:122) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:420) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:356) at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:347) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:330) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:383) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummarySamePage(JRVerticalFiller.java:852) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:782) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:310) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:193) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:558) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:160) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:353) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:293) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:445) at java.lang.Thread.run(Unknown Source) NESTED BY : java.lang.ClassCastException at Finding_Nemo.evaluate(Finding_Nemo.java:122) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:420) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:356) at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:347) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:330) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:383) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummarySamePage(JRVerticalFiller.java:852) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:782) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:310) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:193) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:558) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:160) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:353) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:293) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:445) at java.lang.Thread.run(Unknown Source) NESTED BY : net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : image_1 Source text : (java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=290","serie1=SERIE_num","plotBackground=[255,255,255]","serie0=SERIE_Name","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=false","quality=2","height=157","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)$P{REPORT_SCRIPTLET}) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:427) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:356) at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:347) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:330) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:383) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummarySamePage(JRVerticalFiller.java:852) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:782) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:310) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:193) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:558) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:160) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:353) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:293) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:445) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassCastException at Finding_Nemo.evaluate(Finding_Nemo.java:122) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:420) ... 14 more Print not filled. Try to use an EmptyDataSource...!

 

 

/*

* Generated by JasperReports - 17/08/06 11:49 AM

*/

import net.sf.jasperreports.engine.*;

import net.sf.jasperreports.engine.fill.*;

 

import java.util.*;

import java.math.*;

import java.text.*;

import java.io.*;

import java.net.*;

 

 

/**

*

*/

public class Finding_Nemo extends JRCalculator

{

 

 

/**

*

*/

private JRFillParameter parameter_DateTo = null;

private JRFillParameter parameter_REPORT_CONNECTION = null;

private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null;

private JRFillParameter parameter_DateFrom = null;

private JRFillParameter parameter_REPORT_DATA_SOURCE = null;

private JRFillParameter parameter_REPORT_SCRIPTLET = null;

 

private JRFillField field_sys_ref_id1 = null;

private JRFillField field_sys_ref_id0 = null;

 

private JRFillVariable variable_PAGE_NUMBER = null;

private JRFillVariable variable_COLUMN_NUMBER = null;

private JRFillVariable variable_REPORT_COUNT = null;

private JRFillVariable variable_PAGE_COUNT = null;

private JRFillVariable variable_COLUMN_COUNT = null;

private JRFillVariable variable_test = null;

private JRFillVariable variable_SERIE_Name = null;

private JRFillVariable variable_SERIE_num = null;

 

 

/**

*

*/

public void customizedInit(

Map pm,

Map fm,

Map vm

) throws JRException

{

parameter_DateTo = (JRFillParameter)parsm.get("DateTo");

parameter_REPORT_CONNECTION = (JRFillParameter)parsm.get("REPORT_CONNECTION");

parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)parsm.get("REPORT_PARAMETERS_MAP");

parameter_DateFrom = (JRFillParameter)parsm.get("DateFrom");

parameter_REPORT_DATA_SOURCE = (JRFillParameter)parsm.get("REPORT_DATA_SOURCE");

parameter_REPORT_SCRIPTLET = (JRFillParameter)parsm.get("REPORT_SCRIPTLET");

 

field_sys_ref_id1 = (JRFillField)fldsm.get("sys_ref_id1");

field_sys_ref_id0 = (JRFillField)fldsm.get("sys_ref_id0");

 

variable_PAGE_NUMBER = (JRFillVariable)varsm.get("PAGE_NUMBER");

variable_COLUMN_NUMBER = (JRFillVariable)varsm.get("COLUMN_NUMBER");

variable_REPORT_COUNT = (JRFillVariable)varsm.get("REPORT_COUNT");

variable_PAGE_COUNT = (JRFillVariable)varsm.get("PAGE_COUNT");

variable_COLUMN_COUNT = (JRFillVariable)varsm.get("COLUMN_COUNT");

variable_test = (JRFillVariable)varsm.get("test");

variable_SERIE_Name = (JRFillVariable)varsm.get("SERIE_Name");

variable_SERIE_num = (JRFillVariable)varsm.get("SERIE_num");

}

 

 

/**

* Test method

*/

public static void helloJasper()

{

System.out.println("------------------------------");

System.out.println(" Hello, Jasper!...");

System.out.println("------------------------------");

}

 

 

/**

*

*/

public Object evaluate(int id) throws Throwable

{

Object value = null;

 

switch (id)

{

case 19 : // variable_REPORT_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 28 : // variable_SERIE_num

{

value = (java.lang.Integer)(Integer.valueOf(((java.lang.String)field_sys_ref_id1.getValue())));

break;

}

case 26 : // variableInitialValue_test

{

value = (java.lang.String)("test");

break;

}

case 35 : // textField_7

{

value = (java.lang.String)("There are " + String.valueOf(((java.lang.Integer)variable_REPORT_COUNT.getValue())) +

" records in the report.");

break;

}

case 24 : // variableInitialValue_COLUMN_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 36 : // image_1

{

value = (java.awt.Image)((java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=290","serie1=SERIE_num","plotBackground=[255,255,255]","serie0=SERIE_Name","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=false","quality=2","height=157","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue())));

break;

}

case 30 : // textField_2

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id0.getValue()));

break;

}

case 23 : // variable_COLUMN_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 31 : // textField_3

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id1.getValue()));

break;

}

case 25 : // variable_test

{

value = (java.lang.String)("test");

break;

}

case 22 : // variableInitialValue_PAGE_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 20 : // variableInitialValue_REPORT_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 33 : // textField_5

{

value = (java.lang.String)("" + ((java.lang.Integer)variable_PAGE_NUMBER.getValue()));

break;

}

case 29 : // textField_1

{

value = (java.lang.String)("For the period from "+ ((java.lang.String)parameter_DateFrom.getValue())+" to " +((java.lang.String)parameter_DateTo.getValue()));

break;

}

case 27 : // variable_SERIE_Name

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id0.getValue()));

break;

}

case 21 : // variable_PAGE_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 17 : // variableInitialValue_PAGE_NUMBER

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 32 : // textField_4

{

value = (java.lang.String)("Page " + ((java.lang.Integer)variable_PAGE_NUMBER.getValue()) + " of ");

break;

}

case 34 : // textField_6

{

value = (java.util.Date)(new Date());

break;

}

case 18 : // variableInitialValue_COLUMN_NUMBER

{

value = (java.lang.Integer)(new Integer(1));

break;

}

default :

{

}

}

 

return value;

}

 

 

/**

*

*/

public Object evaluateOld(int id) throws Throwable

{

Object value = null;

 

switch (id)

{

case 19 : // variable_REPORT_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 28 : // variable_SERIE_num

{

value = (java.lang.Integer)(Integer.valueOf(((java.lang.String)field_sys_ref_id1.getOldValue())));

break;

}

case 26 : // variableInitialValue_test

{

value = (java.lang.String)("test");

break;

}

case 35 : // textField_7

{

value = (java.lang.String)("There are " + String.valueOf(((java.lang.Integer)variable_REPORT_COUNT.getOldValue())) +

" records in the report.");

break;

}

case 24 : // variableInitialValue_COLUMN_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 36 : // image_1

{

value = (java.awt.Image)((java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=290","serie1=SERIE_num","plotBackground=[255,255,255]","serie0=SERIE_Name","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=false","quality=2","height=157","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue())));

break;

}

case 30 : // textField_2

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id0.getOldValue()));

break;

}

case 23 : // variable_COLUMN_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 31 : // textField_3

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id1.getOldValue()));

break;

}

case 25 : // variable_test

{

value = (java.lang.String)("test");

break;

}

case 22 : // variableInitialValue_PAGE_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 20 : // variableInitialValue_REPORT_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 33 : // textField_5

{

value = (java.lang.String)("" + ((java.lang.Integer)variable_PAGE_NUMBER.getOldValue()));

break;

}

case 29 : // textField_1

{

value = (java.lang.String)("For the period from "+ ((java.lang.String)parameter_DateFrom.getValue())+" to " +((java.lang.String)parameter_DateTo.getValue()));

break;

}

case 27 : // variable_SERIE_Name

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id0.getOldValue()));

break;

}

case 21 : // variable_PAGE_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 17 : // variableInitialValue_PAGE_NUMBER

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 32 : // textField_4

{

value = (java.lang.String)("Page " + ((java.lang.Integer)variable_PAGE_NUMBER.getOldValue()) + " of ");

break;

}

case 34 : // textField_6

{

value = (java.util.Date)(new Date());

break;

}

case 18 : // variableInitialValue_COLUMN_NUMBER

{

value = (java.lang.Integer)(new Integer(1));

break;

}

default :

{

}

}

 

return value;

}

 

 

/**

*

*/

public Object evaluateEstimated(int id) throws Throwable

{

Object value = null;

 

switch (id)

{

case 19 : // variable_REPORT_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 28 : // variable_SERIE_num

{

value = (java.lang.Integer)(Integer.valueOf(((java.lang.String)field_sys_ref_id1.getValue())));

break;

}

case 26 : // variableInitialValue_test

{

value = (java.lang.String)("test");

break;

}

case 35 : // textField_7

{

value = (java.lang.String)("There are " + String.valueOf(((java.lang.Integer)variable_REPORT_COUNT.getEstimatedValue())) +

" records in the report.");

break;

}

case 24 : // variableInitialValue_COLUMN_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 36 : // image_1

{

value = (java.awt.Image)((java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=290","serie1=SERIE_num","plotBackground=[255,255,255]","serie0=SERIE_Name","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=false","quality=2","height=157","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue())));

break;

}

case 30 : // textField_2

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id0.getValue()));

break;

}

case 23 : // variable_COLUMN_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 31 : // textField_3

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id1.getValue()));

break;

}

case 25 : // variable_test

{

value = (java.lang.String)("test");

break;

}

case 22 : // variableInitialValue_PAGE_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 20 : // variableInitialValue_REPORT_COUNT

{

value = (java.lang.Integer)(new Integer(0));

break;

}

case 33 : // textField_5

{

value = (java.lang.String)("" + ((java.lang.Integer)variable_PAGE_NUMBER.getEstimatedValue()));

break;

}

case 29 : // textField_1

{

value = (java.lang.String)("For the period from "+ ((java.lang.String)parameter_DateFrom.getValue())+" to " +((java.lang.String)parameter_DateTo.getValue()));

break;

}

case 27 : // variable_SERIE_Name

{

value = (java.lang.String)(((java.lang.String)field_sys_ref_id0.getValue()));

break;

}

case 21 : // variable_PAGE_COUNT

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 17 : // variableInitialValue_PAGE_NUMBER

{

value = (java.lang.Integer)(new Integer(1));

break;

}

case 32 : // textField_4

{

value = (java.lang.String)("Page " + ((java.lang.Integer)variable_PAGE_NUMBER.getEstimatedValue()) + " of ");

break;

}

case 34 : // textField_6

{

value = (java.util.Date)(new Date());

break;

}

case 18 : // variableInitialValue_COLUMN_NUMBER

{

value = (java.lang.Integer)(new Integer(1));

break;

}

default :

{

}

}

 

return value;

}

 

 

}

 

 

 

<submissions>

<xsubmission>

<sys_ref>

<id0>Ljungberg</id0>

<id1>233</id1>

</sys_ref>

</xsubmission>

<xsubmission>

<sys_ref>

<id0>Cesc</id0>

<id1>55</id1>

</sys_ref>

</xsubmission>

<xsubmission>

<sys_ref>

<id0>Wenger</id0>

<id1>666</id1>

</sys_ref>

</xsubmission>

<xsubmission>

<sys_ref>

<id0>Henry</id0>

<id1>14</id1>

</sys_ref>

</xsubmission>

</submissions>

 

I really appreciate your time and help!!

Post edited by: arthur17, at: 2006/08/17 16:22

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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