Home
Analytics
BIRT report charts are not visible in browser
pinargocebe
I am using BIRT reporting tool in my SEAM application. Also I downloaded Birt designer professional (Actuate 11SP3) to using flash charts. When I preview report in Actuate viewer, there is any error, everything is ok flash is playing and images are visible ,but when I open it in browser (IE,Mozilla or Chrome) flash charts, normal charts and images are not visible. On the other hand Lists, tables or labels are visible in browsers.<br />
<br />
Also In deployment I receive an exception like this ;<br />
<br />
<em class='bbc'>java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory</em><br />
<br />
I don't know this exception affects visibility of charts and images. How can I fix this visibility problem.<br />
<br />
(I am using Eclipse helios, Seam 2.2, Actuate 11SP3, JBoss AS 6.0)
Find more posts tagged with
Comments
pinargocebe
I fixed IllegalStateException with this solution;<br />
<a class='bbc_url' href='
http://community.jboss.org/thread/193745'>here</a><br
/>
There are some changes in web.xml file in this ,but visibility problem still is going on.
JasonW
What runtime are you using with JBoss. Ie what birt engine?
Jason
paladin74
Hi folks,
I have a similar problem. I have written a custom servlet (see snippet below) which uses BIRT 2.6.2 to pass XML DOM stream to a report. The browser, Firefox or Opera shows nothing, when displaying the source code of the output Firefox is complete empty and Opera has simple html, header and body tags but all empty.
response.setContentType("text/html");
//response.setContentType("image/svg+xml");
String reportName = "AnalyseResult.rptdesign";
ServletContext sc = request.getSession().getServletContext();
this.birtReportEngine = TTB_BirtEngine.getBirtEngine(sc);
//ByteArrayInputStream inputStream = new ByteArrayInputStream(xmlAsWriter.toString().getBytes("UTF-8"));
//HTMLRenderContext renderContext = new HTMLRenderContext();
//renderContext.setBaseImageURL(request.getContextPath()+"/images");
//renderContext.setImageDirectory(sc.getRealPath("/images"));
HTMLRenderOption options = new HTMLRenderOption();
//options.setImageDirectory("./");
options.setImageHandler(new HTMLServerImageHandler());
options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setBaseImageURL(request.getContextPath()+"/images");
options.setImageDirectory(sc.getRealPath("/images"));
//options.setEmbeddable(true);
logger.log( Level.FINE, "image directory " + sc.getRealPath("/images"));
System.out.println("stdout image directory " + sc.getRealPath("/images"));
/*
java.util.Map<String, HTMLRenderContext> contextMap =
new HashMap<String, HTMLRenderContext>();
contextMap.put
(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
*/
try{
IReportRunnable design;
//Open report design - sc.getRealPath gets to /opt/tomcat/webapps/web/Reports
design = birtReportEngine.openReportDesign(sc.getRealPath("/Reports"+"/"+reportName));
//create task to run and render report
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );
//task.setAppContext( contextMap );
StringWriter xmlAsWriter = new StringWriter();
StreamResult streamResult = new StreamResult(xmlAsWriter);
TransformerFactory.newInstance().newTransformer().transform(new DOMSource(xmlResponse.getDomDocument()), streamResult);
// write changes
ByteArrayInputStream inputStream = new ByteArrayInputStream(xmlAsWriter.toString().getBytes("UTF-8"));
java.util.Map appContext = task.getAppContext();
//appContext.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
//FileInputStream fileInputStream = new FileInputStream("D:/workspaces/birt/2.2.2/datasource/batch/reports/report.xml");
appContext.put("org.eclipse.datatools.enablement.oda.xml.inputStream", inputStream);
//Use closeInputStream (true) to let BIRT automatically close the inputStream.
appContext.put("org.eclipse.datatools.enablement.oda.xml.closeInputStream", "true");
//run report
task.setAppContext(appContext);
task.setRenderOption(options);
task.run();
task.close();
}
catch (EngineException e) {
Any help is welcome!
Regards,
Pala
pinargocebe
Hi,
I am using Birt 2.6.3 runtime and my problem stil is going on.
JasonW
Pinargocebe,
Can you post your code? BTW if you are using Actuate you could also look at using the JSAPI. See this article:
http://birtworld.blogspot.com/2010/01/using-acutates-jsapi-with-jboss-seam.html
Jason
JasonW
Palidin74,
Does your code work if you do not pass in the xml stream?
Jason
paladin74
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="98521" data-time="1333470635" data-date="03 April 2012 - 09:30 AM"><p>
Palidin74,<br />
<br />
Does your code work if you do not pass in the xml stream?<br />
<br />
Jason<br /></p></blockquote>
<br />
Jason,<br />
<br />
following lines have been removed from the servlet:<br />
<em class='bbc'><br />
appContext.put("org.eclipse.datatools.enablement.oda.xml.inputStream", inputStream);<br />
<br />
appContext.put("org.eclipse.datatools.enablement.oda.xml.closeInputStream", "true");</em><br />
<br />
<br />
Unfortunately, with the same result as described above. The custom_<some_long_number>.svg is created in images directory, and opening the file directly with the firefox browser of cause showing the data which was originally used when created the report file.<br />
<br />
Regards,<br />
<br />
Pala
JasonW
I assume if you use png output format for charts the file does not come through?
Jason
paladin74
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="98659" data-time="1333659248" data-date="05 April 2012 - 01:54 PM"><p>
I assume if you use png output format for charts the file does not come through?<br />
<br />
Jason<br /></p></blockquote>
<br />
Jason,<br />
<br />
changing the output format from svg to png on the report design did not make any change. The file is created but does not come through.<br />
<br />
Pala.
JasonW
Pala,
I did not see in your code where you are setting the output. Are you sending it to a file or an output stream?
options.setOutputStream(resp.getOutputStream());
Jason
paladin74
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="98765" data-time="1334068111" data-date="10 April 2012 - 07:28 AM"><p>
Pala,<br />
<br />
I did not see in your code where you are setting the output. Are you sending it to a file or an output stream?<br />
<br />
options.setOutputStream(resp.getOutputStream());<br />
<br />
Jason<br /></p></blockquote>
<br />
<br />
Jason,<br />
<br />
thanks it works fine, now.