posted 19 years ago
Hi All, I'm having a problem getting Jasper to work correctly.. I always get an Error Loading Object From InputStream exception on the JasperRunManager line...
my code is as follows..
try {
Connection con = com.dbws.king.DBConnection.getJNDIConnection();
response.setHeader("Cache-Control", "max-age=30");
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "attachment; filename=reportpdf.pdf");
ServletContext sc = getServletContext();
InputStream is = getServletContext().getResourceAsStream("WEB-INF/Reports/test2.jasper");
Map parameters = new HashMap();
JasperRunManager.runReportToPdfStream( is,response.getOutputStream(),parameters,con);
} catch(Exception e) {System.out.println(e.toString());}
whilst debugging I can confirm that is not null so the path to the file is correct and is being picked up, so i'm not sure why it would be having a problem with the InputStream. The .jasper file I created in iReport.
Any thoughts appreciated.
Regards, Dave Brown
SCJP 6 - [url]http://www.dbws.net/[/url] - Check out Grails Forum