2006 JR Open Discussion Posted August 22, 2006 Share Posted August 22, 2006 By: Lucho - rebprotizer Jasper fillReport method failed in struts 2006-07-12 03:15I would like to create a PDF file in a struts action, but the fillReport method doesn't work and any exception is catched. My source here : logger.info("Etape 1"); String reportName = "C:/DRA-Reports/maquette_REC02.jasper"; logger.info("Etape 2"); String pdfName = "C:/DRA-Reports/namePdf.pdf"; logger.info("Etape 3"); try { JasperPrint jasperPrint = JasperFillManager.fillReport(reportName, new HashMap(), new JREmptyDataSource()); } catch (JRException e) { e.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } logger.info("Etape 4"); JasperExportManager.exportReportToPdfFile(jasperPrint, pdfName); When I execute my action, i have an error : null, but any exception is catched. So i didn't know why the Etape 4 logger is not displayed. I have replace reportName by : this.getClass().getClassLoader().getResourceAsStream("maquette_REC02.jasper") for a relative path, but I have the same error. I have the feel that the fillReport crashed the system but I don't know why. Can you help me please, it's very urgent. Thank you. Luc LABBE By: dreporter - dreporter RE: Jasper fillReport method failed in struts 2006-07-12 08:37Does your report require any parameters and are you passing any values? Here is how I have done it in java. hm = new HashMap(); JasperReport report = (JasperReport) JRLoader.loadObject(reportName); JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(reportName, hm, myconn); JasperExportManager.exportReportToPdfFile(jprint,pdfName); 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