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

Class Format error in Scriplet


burasami

Recommended Posts

hai for past two days i have been wasted my time for adding two sub report return value. i have seen some post in this form such that " you can't able compute any opertion on return value from sub report" so that i have wrote a scriplet to perform add opertion on those two return value. i have created Sample_Scriplet.java,Sample_Scriplet.class,

and created a Sample_Scriplet.jrxml and placed this files in same directory. while i am running the jrxml file iReport shows following error..

please help me. its very urgent.. here by i attached my scriplet file... help me .. thanks in advance

 

Error filling print...  java.lang.ClassFormatError:  Incompatible magic value 1768779887 in class file Sample_Scriplet null

java.lang.ClassFormatError: Incompatible magic valu 1768779887a in a class a file a Sample_Scriplet at a

java.lang.ClassLoader.defineClass1(Native Method) at a java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.lang.ClassLoader.defineClass(ClassLoader.java:465) at it.businesslogic.ireport.ReportClassLoader.loadClassData(ReportClassLoader.java:422) at a it.businesslogic.ireport.ReportClassLoader.findClass(ReportClassLoader.java:351) at a java.lang.ClassLoader.loadClass(ClassLoader.java:306) at a java.lang.ClassLoader.loadClass(ClassLoader.java:251) at a java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at a java.lang.Class.forName0(Native Method) a at a java.lang.Class.forName(Class.java:242) at a net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:72) at a net.sf.jasperreports.engine.fill.JRFillDataset.createScriptlet(JRFillDataset.java:445) at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:590) at a net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:879) a at a net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:708) at a net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234) at a it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:752) at a java.lang.Thread.run(Thread.java:595)

Print not a filled. a Try to use a an EmptyDataSource...!

 

 

 

 

 

import net.sf.jasperreports.engine.JRDefaultScriptlet;

import net.sf.jasperreports.engine.JRScriptletException;

 

 

public class Sample_Scriplet extends JRDefaultScriptlet {

 

/** Creates a new instance of JRIreportDefaultScriptlet */

public void afterGroupInit(String groupName) throws JRScriptletException {

 

if (groupName.equals("sales"))

{

System.out.println( this.getVariableValue("Total_Charge"));

 

BigDecimal Total_Charge = (java.math.BigDecimal)getVariableValue("Total_Charge") ;

BigDecimal Total_Tax = (java.math.BigDecimal)getVariableValue("Tot_Tax");

this.setVariableValue("Grand_Total",(java.math.BigDecimal)getVariableValue("Total_Charge"));

// this.setVariableValue("AllCities", sbuffer.toString());

}

}

 

 

 

/** Begin EVENT_AFTER_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */

public void afterColumnInit() throws JRScriptletException

{

super.beforeColumnInit();

}

/** End EVENT_AFTER_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_AFTER_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */

public void afterDetailEval() throws JRScriptletException

{

super.afterDetailEval();

}

/** End EVENT_AFTER_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_AFTER_GROUP_INIT This line is generated by iReport. Don't modify or move please! */

public void afterGroupInit(String groupName) throws JRScriptletException

{

super.afterGroupInit(groupName);

}

/** End EVENT_AFTER_GROUP_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_AFTER_PAGE_INIT This line is generated by iReport. Don't modify or move please! */

public void afterPageInit() throws JRScriptletException

{

super.afterPageInit();

}

/** End EVENT_AFTER_PAGE_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_AFTER_REPORT_INIT This line is generated by iReport. Don't modify or move please! */

public void afterReportInit() throws JRScriptletException

{

 

}

/** End EVENT_AFTER_REPORT_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_BEFORE_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */

public void beforeColumnInit() throws JRScriptletException

{

 

}

/** End EVENT_BEFORE_COLUMN_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_BEFORE_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */

public void beforeDetailEval() throws JRScriptletException

{

 

}

/** end EVENT_BEFORE_DETAIL_EVAL Please don't touch or move this comment*/

 

/** End EVENT_BEFORE_DETAIL_EVAL This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_BEFORE_GROUP_INIT This line is generated by iReport. Don't modify or move please! */

public void beforeGroupInit(String groupName) throws JRScriptletException

{

 

}

/** End EVENT_BEFORE_GROUP_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_BEFORE_PAGE_INIT This line is generated by iReport. Don't modify or move please! */

public void beforePageInit() throws JRScriptletException

{

 

}

/** End EVENT_BEFORE_PAGE_INIT This line is generated by iReport. Don't modify or move please! */

/** Begin EVENT_BEFORE_REPORT_INIT This line is generated by iReport. Don't modify or move please! */

public void beforeReportInit() throws JRScriptletException

{

 

}

 

/** End EVENT_BEFORE_REPORT_INIT This line is generated by iReport. Don't modify or move please! */

 

}

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

First issue I see is that you are creating your own version of afterGroupInit at the begining of you file. You code should be down further in the existing afterGroupInit.

 

In Report Properties have you set Scriptlet Class to "Use iReport internal scriptlet class"?

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