0 Replies Latest reply: Aug 23, 2010 12:26 AM by 807567 RSS

    Error loading object from file in JasperReport Can any one Help...

      Hai to all I am new to jasper reports can any one help me to solve this problem

      I had created a java bean with two string variable,
      I had created a java class to set the values this is the java class,

      package cls_PrintJasper;

      import java.util.ArrayList;
      import java.util.HashMap;
      import java.util.Map;
      import net.sf.jasperreports.engine.JRException;
      import net.sf.jasperreports.engine.JasperCompileManager;
      import net.sf.jasperreports.engine.JasperFillManager;
      import net.sf.jasperreports.engine.JasperPrint;
      import net.sf.jasperreports.engine.JasperPrintManager;
      import net.sf.jasperreports.engine.JasperReport;
      import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
      import net.sf.jasperreports.engine.util.JRLoader;

      public class Cls_Action {
           public static void main(String ar[]) throws JRException
                try {
                     ArrayList<Cls_Bean> al=new ArrayList<Cls_Bean>();
                     HashMap jasperParameter = new HashMap();
                     JasperReport jasperreport = null;
                     int i;
                          Cls_Bean frm = new Cls_Bean();
                     String Context="D:\\Jasper Workouts\\FirstJasperReport\\src\\jasperDesign\\FirstReport.jrxml";
                     jasperreport = (JasperReport)JRLoader.loadObject(Context);
                     System.out.println("Report Created");
                     JasperPrint jasperprint;
                     jasperprint = JasperFillManager.fillReport(jasperreport, jasperParameter,new JRBeanCollectionDataSource(al));
                     JasperReport jasperReport = JasperCompileManager.compileReport(Context);
                     JasperPrintManager.printReport(jasperprint, false);
           } catch (Exception e)

      This is the Error I got

      net.sf.jasperreports.engine.JRException: Error loading object from file : D:\Jasper Workouts\FirstJasperReport\src\jasperDesign\FirstReport.jrxml