Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Birt Report Error while download as pdf
Kiranmca
HI all,
I have created the .rptdesign file using the birt eclipse plugin.it was working fine.
I tried to export the .rptdesing file as pdf or xls through the java class ,i am getting the error. the following java code which i used to export the file
HttpSession httpSession = request.getSession();
String path = (String) httpSession.getAttribute("path");
// get report name and launch the engine
response.setContentType("application/pdf");
response.setHeader("Content-Disposition",
"inline; filename=xxxx.pdf"); // inline,
// attachment
// String reportName = request.getParameter("ReportName");
String reportName = "****.rptdesign";
ServletContext sc = request.getSession().getServletContext();
this.birtReportEngine = BirtEngine.getBirtEngine(sc);
// setup image directory
HTMLRenderOption options = new HTMLRenderOption();
options.setBaseImageURL(request.getContextPath() + "/images");
options.setImageDirectory(sc.getRealPath("/images"));
HashMap<String, HTMLRenderOption> contextMap = new HashMap<String, HTMLRenderOption>();
contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
options);
IReportRunnable design;
try {
// Open report design
design = birtReportEngine.openReportDesign(sc
.getRealPath("/report")
+ "/" + reportName);
// create task to run and render report
IRunAndRenderTask task = birtReportEngine
.createRunAndRenderTask(design);
task.setAppContext(contextMap);
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
options.setOutputStream(response.getOutputStream());
task.setRenderOption(options);
task.run();
task.close();
} catch (Exception e) {
throw new ServletException(e);
}
I am getting the following error
"javax.servlet.ServletException: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report".
details of the error:
java.lang.NoSuchMethodError: org.eclipse.birt.data.engine.api.querydefn.BaseDataSetDesign.setNeedCache(Z)V
and if i use the response.getOutputStream.flush() to flush the data on the response
its says "file is either in not supported format or file might be damaged "
Can some one please help me to get out on this issues asap.
Thanks
kiran
Find more posts tagged with
Comments
mwilliams
What is your BIRT version?
bognekadje
Hi all,<br />
I post this message becausse working which BIRT 4.2.0 using Maven in a web application. I got similar error message. This error message contains following lines<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
Caused by: java.lang.NoSuchMethodError: org.eclipse.birt.data.engine.api.querydefn.BaseDataSetDesign.setNeedCache(Z)V
at org.eclipse.birt.report.data.adapter.impl.ModelAdapter.adaptDataSet(ModelAdapter.java:182)
at org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.doDefineDataSet(ModelDteApiAdapter.java:294)
at org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.defineDataSet(ModelDteApiAdapter.java:235)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.defineDataSet(AbstractDataEngine.java:121)
at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.createDataSession(GetParameterDefinitionTask.java:628)
at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getResultSetForParameter(GetParameterDefinitionTask.java:1372)
at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getChoicesFromParameterQuery(GetParameterDefinitionTask.java:1353)
at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.doGetSelectionList(GetParameterDefinitionTask.java:517)
at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getSelectionList(GetParameterDefinitionTask.java:447)
</pre>
Firstly i was surprising since i do not ahve this problem before and it started without particular reasons.<br />
After comparing previous version with current one, i remark that these files appears:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
org.eclipse.birt.data-3.7.1.v20110905.jar
org.eclipse.birt.data-3.7.1.v20110905.jar
</pre>
These files was not in previous version and i do not understand why they appears now.<br />
In my opinion, they created a conflict for class BaseDataSetDesign and this trigger exception. I talk that because when i delete this file, my application works fine.<br />
<br />
Can somebody explain me this situation? Thanks for your help.<br />
<br />
Eric.