Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Unable to include report library at run time
hkseeram
We are currently using BIRT2.3.1 until now no problems. We use the following code to include report library at run time and it is working fine in BIRT2.3.1.
report.includeLibrary(reportLibPath, ReportConstants.COMMON_LIB_NAMESPACE);
We upgraded to BIRT3.7 and in this release in the report output we don?t see any objects that were inherited from the report library. I am getting ?report library libs/CommonRepotLib.rptlibrary not found? error message.
Any idea why it is working in BIRT2.3.1 but not in BIRT3.7?
Please see the following snippet of the code that we used to include library:
EngineConfig config = new EngineConfig();
config.setLogConfig(configProps.getProperty("logDirectory"), Level.ALL);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
reportEngine = factory.createReportEngine( config );
IReportRunnable runnable = reportEngine.openReportDesign(new ClassPathResource(rptDesign).getInputStream());
IRunAndRenderTask runAndRenderTask = reportEngine.createRunAndRenderTask(runnable);
ModuleHandle report = runnable.getDesignHandle().getModuleHandle();
rptLib = getApplicationConfiguration().get(ReportConstants.LIB_ROOT_DIR) ;
//report.setResourceFolder(getApplicationConfiguration().get(ReportConstants.REPORT_ROOT_DIR));
//report.includeLibrary(rptLib, "CommonReportLib");
/*List<LibraryHandle> libList = report.getAllLibraries();
for (LibraryHandle lib:libList) {
report.includeLibrary(lib.getFileName(), "Template");
}*/
HTMLRenderOption htmlRenderOption = new HTMLRenderOption();
htmlRenderOption.setOutputFileName(fileWithFullPathInfo);
htmlRenderOption.setOutputFormat(msg.getOutputFormat());//ReportConstants.EXCEL_OUTPUT_FORMAT);
runAndRenderTask.setRenderOption(htmlRenderOption);
runAndRenderTask.run();
runAndRenderTask.close();
Also please see the report design file and library files are attached here.
Thanks for your help
Hari
Find more posts tagged with
Comments
Santek
I was able to fix this issue by the following code:
LibraryHandle lib = report.getLibrary("CommonReportLib");
lib.setFileName(rptLib);
report.dropLibrary(lib);
report.includeLibrary(rptLib, lib.getNamespace());