nanosk Posted April 26, 2012 Share Posted April 26, 2012 Hello,we're developing a Glassfish 3.1.x (JEE 6) based Application using "embedded" JasperReports (v4.5.1) to generate various Documents. Documents are typically created in two steps: firstly create the JasperPrint XML, secondly output the XML as a PDF to disk.When I run the following test, I always get an exception printout in my logs create the JasperPrint, convert it to XML and store the XML in a database read the JasperPrintXML from the database and convert it into a JasperPrint instance again (using JRPrintXmlLoader.load(InputStream)) shutdown the Glassfish ServerThe relevant code for step 2 is attached.I also attached the exception printed in my logs. Debugging showed that JRXmlDigester#168 (mentioned in the StackTrace) loads the resource jasperreports.xsd into an InputStream. It seems this InputStream (which is wrapped into an InputSource) is never closed. Yet worse, if the conversion (Step 2) is executed multiple times, I end up with even more unclosed streams (all referring to the same resource).Is it my fault or do I have to file a bug report? Thanks for your time,PeteCode:final InputStream is = new ByteArrayInputStream(job.getJasperData().getBytes());final JasperPrint jasperPrint;try { jasperPrint = JRPrintXmlLoader.load(is);} catch (final JRException e) { throw new PrintException(e, PrintExceptionReason.READING_JASPER_XML_FAILED, job.getBusinessCaseId());} finally { try { is.close(); } catch (final IOException e) { logger.warn("could not close input stream of document for business case {}", job.getBusinessCaseId()); }}return jasperPrint; Link to comment Share on other sites More sharing options...
nanosk Posted May 29, 2012 Author Share Posted May 29, 2012 Added a note to the existing Bug reporthttp://jasperforge.org/projects/jasperreports/tracker/view.php?id=4907 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