Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Executing report from java

  1. #1
    Join Date
    Aug 2007
    Posts
    198

    Default Executing report from java

    Hi,
    I have created a report using the Pentaho report designer, I have taken the xml file from the same report, and I am trying to see the preview from java, for that I have written the following code


    package com.app.engine;

    import java.net.MalformedURLException;
    import java.net.URL;

    import org.jfree.report.JFreeReport;
    import org.jfree.report.demo.util.ReportDefinitionException;
    import org.jfree.resourceloader.Resource;
    import org.jfree.resourceloader.ResourceManager;

    public class PentahoEngine {
    public static void main(String args[]) {
    PentahoEngine pentahoEngine = new PentahoEngine();
    pentahoEngine.loadReport();
    }

    public void loadReport() {
    try {
    URL in = new URL(
    "file://D:/pentahoReportingenginedemo/pentahoReportingEngine/src/com/app/engine/world.xml");
    JFreeReport report = parseReport(in);
    if (report != null) {
    System.out.println("Success");
    }
    } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (ReportDefinitionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    private JFreeReport parseReport(URL in) throws ReportDefinitionException {
    if (in == null) {
    throw new ReportDefinitionException(
    "ReportDefinition Source is invalid");
    }

    try {
    ResourceManager manager = new ResourceManager();
    manager.registerDefaults();
    Resource res = manager.createDirectly(in, JFreeReport.class);
    return (JFreeReport) res.getResource();
    } catch (Exception e) {
    throw new ReportDefinitionException("Parsing failed", e);
    }
    }
    }


    But when I am running this code I am getting the following exception.

    ERROR: org.jfree.report.demo.util.ReportDefinitionException: Parsing failed
    at com.app.engine.PentahoEngine.parseReport(PentahoEngine.java:46)
    at com.app.engine.PentahoEngine.loadReport(PentahoEngine.java:21)Unable to create byte-stream: ResourceKey{schema=org.jfree.resourceloader.loader.URLResourceLoader, identifier=file://D:/pentahoReportingenginedemo/pentahoReportingEngine/src/com/app/engine/world.xml, factoryParameters={}, parent=null}

    at com.app.engine.PentahoEngine.main(PentahoEngine.java:14).


    I have attached my xml, please suggest me, where I am going wrong.

    Thanks
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Give us the full exception please, otherwise we would have to guess. And my guess is that you do not have the chart-expressions in your classpath.

    Also: If you're just starting out with the development, I would heavily recommend to use the upcoming Citrus reporting engine (along with the Citrus-Report-Designer). In Citrus there are heavy API changes, so switching later will be more costly, and above all: There are a lot more features that make using the reporting engine easier to use.

    Pre-Citrus, the report-designer would not include the datasource definitions in the exported report-definition file, and the report-designer required an extra export, there were no parameters and the selection of chart-options and datasources for use outside the Pentaho-Platform was very limited.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Aug 2007
    Posts
    198

    Default Where I can download it

    Hi,

    Where I can download Citrus reporting engine, and Citrus reporting designer, I have tried to down this version from source
    http://sourceforge.net/projects/jfreereport/files/,
    and i have downloaded

    prd-ce-CITRUS-M7.zip,

    but I am not able to understand how can i use this tool, I dnt find any document regarding this designer.

    Whether I have downloaded correct file or not. Please clarify my doubts.

    Parveen

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Pre-built binary files are only available on our CI server @ ci.pentaho.com
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  5. #5
    Join Date
    Aug 2007
    Posts
    198

    Default

    I have resolved the issue.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.