简体   繁体   中英

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?

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 HERE IS ALL JARS LOADED INTO CLASSPATH在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM