BIRT report charts are not visible in browser
#1
Posted 26 March 2012 - 10:45 AM
Also In deployment I receive an exception like this ;
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
I don't know this exception affects visibility of charts and images. How can I fix this visibility problem.
(I am using Eclipse helios, Seam 2.2, Actuate 11SP3, JBoss AS 6.0)
#4
Posted 01 April 2012 - 07:33 AM
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
#6
Posted 03 April 2012 - 08:29 AM
Can you post your code? BTW if you are using Actuate you could also look at using the JSAPI. See this article:
http://birtworld.blo...jboss-seam.html
Jason
#8
Posted 05 April 2012 - 10:48 AM
JasonW, on 03 April 2012 - 08:30 AM, said:
Does your code work if you do not pass in the xml stream?
Jason
Jason,
following lines have been removed from the servlet:
appContext.put("org.eclipse.datatools.enablement.oda.xml.inputStream", inputStream);
appContext.put("org.eclipse.datatools.enablement.oda.xml.closeInputStream", "true");
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.
Regards,
Pala
#10
Posted 06 April 2012 - 07:04 AM





MultiQuote



