Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: BIRT Integration with Liferay DXP 7.4 u77
Hello everyone i am using Liferay 7.4 u77 version and I'm using birt
4.4.2 version i want to generate the birt report using Liferay mvc
portlet i added all the dependencies related to birt but I'm unable
to get the IReportEngineFactory factory = (IReportEngineFactory)
Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
I'm unable to get the factory object i m sharing my complete code for
birt report generation
private IReportEngine getReportEngine() {
IReportEngine engine = null;
EngineConfig config =
null;
try {
config = new
EngineConfig();
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory)
Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
engine.changeLogLevel( Level.WARNING );
} catch
(BirtException ex) {
LOGGER.error(ex);
}
return engine;
}
@Override
public void doView(RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException,
PortletException {
IRunAndRenderTask
runAndRenderTask = null;
try {
IReportEngine reportEngine = getReportEngine();
IReportRunnable report =
reportEngine.openReportDesign("C:\\work\\test\\new_report.rptdesign");
runAndRenderTask =
reportEngine.createRunAndRenderTask(report);
renderResponse.setContentType(reportEngine.getMIMEType("pdf"));
IRenderOption options = new RenderOption();
PDFRenderOption pdfRenderOption = new
PDFRenderOption(options);
pdfRenderOption.setOutputFormat("pdf");
runAndRenderTask.setRenderOption(pdfRenderOption);
runAndRenderTask.getAppContext().put(EngineConstants.
APPCONTEXT_PDF_RENDER_CONTEXT, renderResponse);
HttpServletResponse response =
PortalUtil.getHttpServletResponse(renderResponse);
response.addHeader("Content-disposition", "attachment;
filename=ria-report.pdf");
pdfRenderOption.setOutputStream(response.getOutputStream());
runAndRenderTask.run();
} catch
(Exception e) {
LOGGER.error(e);
}
super.doView(renderRequest,
renderResponse);
}
Thanks
As discussed on Slack, this is rather a question for the BIRT community.
Leading up to this point, you were adding transitive dependencies, until you didn't get any more problems with static binding. My assumption is that it's still possible that the BIRT framework can't find more (optional) transitive dependencies that are technically optional (thus: statically it works), but practically required for the configuration that you attempt to use (thus: The framework doesn't provide you with a factory).
Fine if someone can help here, but I guess the BIRT community might have it easier to identify missing libraries. When you ask there, please provide them with the list of transitive dependencies that you already have added to your system, and ask which additional ones you might be missing.
Also: I find a number of hits when searching for "BIRT createFactoryObject null" - you might want to dig among those.
Powered by Liferay™