【发布时间】:2015-02-01 16:53:48
【问题描述】:
我正在使用 BIRT 运行时发布版本:4.4.1
当我尝试生成 Birt 报告时,我遇到了 EngineException。
代码如下:
try {
final EngineConfig config = new EngineConfig();
// delete the following line if using BIRT 3.7 (or later) POJO
// runtime
// As of 3.7.2, BIRT now provides an OSGi and a POJO Runtime.
config.setEngineHome("C:/Mine/ReportEngine/lib");
// 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);
IReportRunnable report = engine
.openReportDesign("C:/Mine/BirtTraining/demo/demo.rptdesign");
IRunAndRenderTask task = null;
task = engine.createRunAndRenderTask(report);
HTMLRenderOption options = null;
options = new HTMLRenderOption();
options.setOutputFileName("C:/birt.html");
task.setRenderOption(options);
task.run();
System.out.println("All went well. Closing program!");
engine.destroy();
System.exit(0);
} catch (Exception ex) {
ex.printStackTrace();
System.err.println("An error occured while running the report!");
System.exit(-1);
}
这是一个例外:
2015 年 2 月 1 日下午 6:32:13 org.eclipse.birt.report.engine.api.impl.EngineTask createContentEmitter
严重:报告引擎无法创建发射器空值。
2015 年 2 月 1 日下午 6:32:13 org.eclipse.birt.report.engine.api.impl.EngineTask handleFatalExceptions
严重:运行报告时发生错误。原因:
org.eclipse.birt.report.engine.api.EngineException: 报告引擎无法初始化空发射器,请确保已安装此发射器所需的库。
在 org.eclipse.birt.report.engine.api.impl.EngineTask.createContentEmitter(EngineTask.java:1770)
在 org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:106)
在 org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
在 testBirt.Main.main(Main.java:46)
如何初始化发射器?
发射器需要哪些库?
如果有一个完整的示例来生成报告,那就太好了。
提前致谢。
【问题讨论】: