djoleasterix
djoleasterix

Reputation: 51

BIRT report running generates NoClassDefFoundError

I created simple app to generate pdf report using Eclipse BIRT. I loaded jars from ReportEngine folder into project build path. Code looks like this:

EngineConfig config;
try{
    config = new EngineConfig( );
    config.setEngineHome( "C:\\birt-runtime-2_6_2\\birt-runtime-2_6_2\\ReportEngine" );
    config.setLogConfig("c:/temp", Level.FINE);
    ReportEngine engine = new ReportEngine(config);
    engine.changeLogLevel( Level.WARNING );
    String name = "C:\\Users\\Djordje\\EclipseProjects\\ReportingApp\\new_report.rptdesign";
    IReportRunnable report = engine.openReportDesign(new FileInputStream(name  ));
    PDFRenderOption pdf = new PDFRenderOption();
    pdf.setOutputFormat("pdf");
    pdf.setOption(PDFRenderOption.PAGE_OVERFLOW, Integer.valueOf(PDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES));
    pdf.setOption( IRenderOption.HTML_PAGINATION, Boolean.FALSE );
    pdf.setOutputFileName("D:/djole" +".pdf");
    IRunAndRenderTask task  = engine.createRunAndRenderTask(report);
    task.setRenderOption(pdf);
    task.run();
}catch ( Exception e1 ){
}

And here is the error I get when I run the project:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/birt/report/engine/api/IRenderOption
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.report.engine.api.IRenderOption
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

Could someone tell me what am I doing wrong, and is there any tutorial for developing code for running report on desktop app?

enter image description here enter image description here enter image description here HERE IS ALL JARS LOADED INTO CLASSPATH enter image description here

Upvotes: -1

Views: 1749

Answers (1)

djoleasterix
djoleasterix

Reputation: 51

Solved it by using earlier version of birt_runtime, 4.4.1 to be specific. Thanks to triplem for all the effort.

Upvotes: 0

Related Questions