Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 {
@SuppressWarnings("unchecked")
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;
for(i=1;i<=10;i++)
{
Cls_Bean frm = new Cls_Bean();
frm.setRno(""+i);
frm.setStuname("ABC"+i);
al.add(frm);
}
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)
{
System.out.println(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

 
Hindusthan Kamal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one help me with this...
 
Hindusthan Kamal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Error loading object from file in jasper reports
 
Sheriff
Posts: 22054
113
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can start by reading the following two links:
- UseCodeTags
- PatienceIsAVirtue

Are you sure you can read that file? Does it exist? Can you open it in a text editor?
 
Hindusthan Kamal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for you comments and I got the answer too...
 
Marshal
Posts: 71655
312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what was the answer? It would help other people who have similar problems.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic