我們以前使用下面的代碼來設置BIRT引擎以在我們的servlet中使用,遷移指南中說您只需將BIRT jar添加到classpath中,BIRT jar就是添加到WEB-INF \ lib。從BIRT 2.5.2升級到3.7.1
當我們現在運行應用程序時,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時。你解決了這個問題嗎? Thanx提前,Nele – Nele 2012-01-31 10:41:44