Birt空指针异常

时间:2011-08-11 10:10:22

标签: java birt

        config = new EngineConfig();
        config.setEngineHome( "C:/birt-runtime-3_7_0/ReportEngine" );
        // config.setLogConfig("c:/temp", Level.FINE);

        Platform.startup( config );  //If using RE API in Eclipse/RCP application this is not needed.
        IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
        IReportEngine engine = factory.createReportEngine( config );
        // engine.changeLogLevel( Level.WARNING );

        //Open a report design 
        IReportRunnable design = engine.openReportDesign("C:/birt-runtime-3_7_0/ReportEngine/samples/bookingConfirmationBatch.rptdesign"); 

        IGetParameterDefinitionTask task = engine.createGetParameterDefinitionTask( design );
        Collection params = task.getParameterDefns( true );

        //Create task to run and render the report,
        IRunAndRenderTask task2 = engine.createRunAndRenderTask(design); 

-----我正在安排!! ------

java.lang.NullPointerException
    at net.nighttale.scheduling.BookReportGenerator.runBatchReport(BookReportGenerator.java:38)
    at net.nighttale.scheduling.SendBookMail.doPost(SendBookMail.java:126)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,但对于我对Birt 3.7的了解, 你不需要再设置Birt Home了,只需复制ReportEngine / lib中的jar即可 并让他们到你的类路径。

通常你可以删除这一行:

config.setEngineHome( "C:/birt-runtime-3_7_0/ReportEngine" );

如果您仍然有NullPointerException,请检查您的权限。

希望对你有所帮助。

编辑:我不再有问题了,我的包装我的可执行jar很糟糕,现在就像一个魅力!所以我可以确认你不需要上面的3.7及以上版本。