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)
Error occured while running the report in report design using servlet.
Mylsamy
Hi all,
I am using Chart in report design file.
I got error when i try to open the report design file using Servlet.
I'm using IReportEngine to open the file and my code is :
IReportEngine engine=null;
engine = BirtEngine.getBirtEngine(sc);
IReportRunnable design = IReportEngine.openReportDesign(reportFileName );
ReportDesignHandle report = (ReportDesignHandle) design.getDesignHandle( );
ElementFactory designFactory = report.getElementFactory( );
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );
task.setAppContext( contextMap );
PDFRenderOption options = new PDFRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
resp.setHeader( "Content-Disposition", "inline; filename="test.pdf"" );
options.setOutputStream(resp.getOutputStream());
task.setRenderOption(options);
//run report
task.run();
task.close();
If I add any jar files?
How can i solve these problem?
If any samples/tutorials is helpful to me.
Find more posts tagged with
Comments
JasonW
Can you post the error (Stacktrace)?
Jason
Mylsamy
Thanks for Quick Response Joson,
The Exception is :
javax.servlet.ServletException: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report
And root cause : org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report
root cause
I have attached the stack trace as txt file.
If i add any jar files to my project.
And one more doubt jason. The chart image does not display in HTML format , when i view the chart in report design using view option. Can i view the chart image in html?
Please help me
JasonW
Are you using BIRT 2.5.2? Also take a look at this thread:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/forum/eclipse-birt-newsgroup-mirror/15204-npe-chartreportitemutil-java.html'>http://www.birt-exchange.org/forum/eclipse-birt-newsgroup-mirror/15204-npe-chartreportitemutil-java.html</a><br
/>
<br />
Yes chart images can be displayed in html. Make sure you are setting image options like:<br />
HTMLRenderOption options = new HTMLRenderOption();<br />
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);<br />
options.setOutputStream(resp.getOutputStream());<br />
options.setImageHandler(new HTMLServerImageHandler());<br />
options.setBaseImageURL(req.getContextPath()+"/images");<br />
options.setImageDirectory(sc.getRealPath("/images"));<br />
<br />
<br />
Image directory is where the engine creates the images and base image url is what is put in the img src tags in the html output.<br />
<br />
Jason
Mylsamy
Hi jason thanks for your reply,
I am using Birt report version 3.4.2.
I solved the problem print report design file using servlet. I added the chart engine jar files and run this. Now okay, no problem.
But now, my problem is the chart(s) does not display in report design to run the report using servlet.
I was designing the charts(Bar chart and pie chart) in report design file.
I viewed it through birt report in the format of HTML or PDF means it displays the chart. But it does not display the chart(s) in report design in HTML format when i run the report using servlet.
But i run the report in PDF using servlet means it displays the charts in report.
JasonW
Did you set the baseImageUrl? look at my previous response. Post the html that is generated.
Jason
Mylsamy
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="65226" data-time="1275074339" data-date="28 May 2010 - 12:18 PM"><p>
Did you set the baseImageUrl? look at my previous response. Post the html that is generated.<br />
<br />
<br />
Jason<br /></p></blockquote>
<br />
<br />
Thanks for reply Jason,<br />
<br />
Yes i set the basiImageURL, and i have attached the my servlet code and report design. When i run the report through servlet means it print the chart image and table design when view the output format is PDF only. And i try to print the report in html format means it displays table data onyl not chart image. But i add the chart engine API jar files also. <br />
<br />
Please help me..
Mylsamy
Thanks for your useful reply Jason,
It's glad to told you as It's working now.
My report design displays chart also in birt through Servlet.
Thanks for spending your time and guidance.
Thank you very much.
Myl