Results 1 to 3 of 3
  1. #1
    cecily is offline Member
    Join Date
    Jul 2007
    Posts
    33
    Rep Power
    0

    Default Error loading object from file : C:\Date.jrxml Jass Report

    I have problems with this code:
    Java Code:
    import java.util.*;
    import java.sql.Connection;
    
    import java.awt.event.*;
    
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.view.*;
    public class Test extends Thread {
    Connection connection;
    public test(String Clv_area) {
    }
    
    public void run(){
    try
    {
    
    String fileName="C:\\Date.jrxml";
    
    ConexionSingleton connection= connectionSingleton.getInstance();
    Connection con = connection.getConnection();
    
    
    String Clv_area="John";
    Map parameters = new HashMap();
    parameters.put("pname",Clv_area);
    
    JasperPrint jasperPrint = JasperFillManager.fillReport(fileName,parameters,con);
    
    JasperViewer jviewer = new JasperViewer(jasperPrint,false);
    jviewer.show();
    }
    catch (Exception j)
    {
    System.out.println("Error:"+j.getMessage());
    }
    finally{
    thanks in advance

  2. #2
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    10

    Default

    you have to compile it before filling the report, or you can pass the jasper file

  3. #3
    Deepa is offline Member
    Join Date
    Nov 2008
    Posts
    85
    Rep Power
    0

    Default Re:

    Hi,
    U will try the below code.

    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.util.HashMap;
    import net.sf.jasperreports.engine.JRResultSetDataSource;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;

    public class GenerateReport
    {
    public static void main(String args[]) throws Exception
    {
    java.sql.Connection connection = null;
    ResultSet resultSet = null;
    Statement statement = null;
    String reportFile = "C:\\Recent Jasper\\GenerateReport.jrxml";
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String query="SelectUSERID,CURRENCYCODE,NAME,USERTYPE from GWUSER
    connection = DriverManager.getConnection("jdbc:oracle:thin:@172 .16.0.81:1521:CTSINWDT","username","pwd");
    statement = connection.createStatement();
    resultSet = statement.executeQuery(query);
    JasperReport jasperReport = JasperCompileManager.compileReport(reportFile);
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),new JRResultSetDataSource(resultSet));
    if(jasperPrint.getPages().isEmpty()== false)
    {
    JasperExportManager.exportReportToPdfFile(jasperPr int,"C://1.pdf");
    System.out.println("your file updated to pdf file plz check pdf file on desktop");
    }

    }
    }

Similar Threads

  1. Error loading SolarisSerial:
    By musiigedeo in forum Advanced Java
    Replies: 5
    Last Post: 02-17-2010, 04:38 PM
  2. Error With Sql And Jasper Report
    By Heather in forum JDBC
    Replies: 4
    Last Post: 12-03-2008, 12:31 PM
  3. Replies: 0
    Last Post: 04-05-2008, 10:10 AM
  4. How to find file created date.....
    By roshithmca in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2008, 10:48 AM
  5. Loading of JSP file failed
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-06-2007, 01:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •