2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 By: Michael Bauer - mbabauer Problem with empty report 2004-06-15 13:00 I am working on a web reporting engine using JasperReports as the processing piece, but I am having a problem with my JasperPrint object not returning any results. My first iteration worked, but was clunky, so I moved it to STRUTS/JBoss. I now have a helper class that has a method that gets the HTML from the report. This code builds the JasperPrint as such: JasperPrint print = null String xml = <pull XML from Database> StringInputStream sis = StringInputStream(xml); JasperReport report = JasperManager.compileReportsis(); ... do some stuff to build parameters Map... Connection conn = null ... try to get the connection using JNDI, else just build it from the DB Drivers... print = JasperManager.fillReport(report,map,conn); I removed a bunch of the code, not because its super-secret, but because it was irrelevant really. Anyway, later in the code I do: JRHtmlExporter exporter = new JRHtmlExporter(); Boolean isOutImagesToDir = (Boolean)getProperty("jasper.report.image.output_to_dir",Boolean.FALSE); exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR,isOutImagesToDir); if(isOutImagesToDir.booleanValue()) { String outputDir = (String)getProperty("jasper.report.image.output_dir","."); exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME,outputDir); } String imagesUri=(String)getProperty("jasper.report.images.uri"); if(imagesUri!=null && !imagesUri.equals("")) { exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,imagesUri); } exporter.setParameter(JRHtmlExporterParameter.JASPER_PRINT,print); exporter.setParameter(JRHtmlExporterParameter.OUTPUT_STRING_BUFFER,sBuff); When the report prints, however, all I get is an empty web page, with the html and body tags, but no data or images. I tried exporting to a PDF file, but still I get an empty page. Up until the point that I create the JasperPrint, everything seems right in my debugger. Even the JasperReport object has elements and fields. I have triple-checked my SQL and all seems fine. Whats wierd is that I had this working in a proof of concept. One more question...does anyone know how to turn on logging or error reporting in JasperReports? Is it Log4J friendly? I would like to trace the code if I could. Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now