【发布时间】:2012-01-06 16:57:55
【问题描述】:
我们之前使用下面的代码来设置 BIRT Engine 以在我们的 servlet 中使用,迁移指南说您只需将 BIRT jar 添加到类路径,BIRT jar 已添加到 WEB-INF\lib。
当我们现在运行应用程序时,IReportEngineFactory 返回 null。任何帮助表示赞赏。
public static synchronized IReportEngine getBirtEngine(ServletContext sc) throws Exception {
EngineConfig config = new EngineConfig();
config.setBIRTHome("");
config.setLogConfig("C:/Temp", Level.FINEST);
config.setLogFile("birtLog.log");
realPath = sc.getRealPath("/reports");
log.info("Server Info: " + sc.getServerInfo());
log.info(" Servlet Context Name: " + sc.getServletContextName());
log.info("Real Path: " + realPath);
log.info("#####Creating new Birt Engine#####");
//log.info("Birt Home is: " + config.getBIRTHome());
IPlatformContext context = new PlatformServletContext(sc);
config.setPlatformContext(context);
try {
Platform.startup(config);
//log.info("Birt Home is: " + config.getPlatformContext().toString());
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject
(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
birtEngine = factory.createReportEngine(config);
}
catch (Exception e ) {
throw e;
}
return birtEngine;
}
【问题讨论】:
-
我面临着完全相同的问题。从 BIRT 2.5.2 升级到 BIRT 3.7.1 时。你解决了这个问题吗?提前感谢,内尔