Jump to content
JasperReports Library 7.0 is now available ×

Jasper sub reports are not being updated on tomcat


semog1epilif

Recommended Posts

I have a jasper report (crfTemplate.jrxml) with a sub-report (crfCover.jrxml) and when I make a change in the sub-report and deploy the new war in tomcat the change does not appear in the file (it always get the older sup-report). But when I change the main report (it is my code that gets the main report) the change appears in the file.


The jasper reports are in a jar on the war file. And in order the sub-report to be update I need to restart the tomcat. And this only happens when the tomcat unpackWAR is set to true.


My question is why this is happening (Jasper report have some kind of cache?) and what I have to do to not have to restart the tomcat all the time besides to change the option unpackWAR to false?


The jasper-report version that I am using is 5.6.0 and the tomcat is 6.


In my Java code I have this:


String fileName = filePath + "/name" + SystemDate.getDate().getTime();      [/code]
Map<String, Object> parameters = setUpParameters(trial.getId(), patientCRFData.getStage(), trial, crf, options);      [/code]
InputStream io = this.getClass().getResourceAsStream("/crfTemplate.jasper");      [/code]
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(io);   [/code]
JRDataSource ds = new JRBeanCollectionDataSource(patientCRFs);   [/code]
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds);         [/code]
JasperExportManager.exportReportToPdfFile(jasperPrint, fileName);      [/code]
InputStream template = new DataInputStream(new FileInputStream(filePath));[/code]

And in the crfTemplate.jrxml I have this:


 <detail>                                                                                                                                  <band height="700">                                                                                                                       <subreport isUsingCache="false">                                                                                                          <reportElement x="0" y="0" width="555" height="100" uuid="13e1c2e2-4f44-4441-9890-7f9008b82955"/>                                     <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{PATIENT_INFORMATION})]]></dataSourceExpression>                                                                                                                           <subreportExpression><![CDATA["crfCoverPage.jasper"]]></subreportExpression>                                                       </subreport>                                                                                                                     </band>                                                                                                                           </detail>[/code]
 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

I do not think that this is related to JR but on some kind of caching or persistence in your web app. Without looking at your code or how your web app is implementing the JR calls for the report and subreport is dificult to troubleshoot.

Have you tried cleaning the work directory and temp instead of restarting tomcat? If that works that will give you the indication that tomcat is the one caching the call to the subrep..

Link to comment
Share on other sites

When I change the crfCover.jrxml name to something else it gives the following error but the file is in the jar (if again I restart the tomcat the error disappears):

 

net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error opening input stream from URL : jar:file:/usr/share/tomcat6/webapps/edc/WEB-INF/lib/cm-persistence-3.1.0-SNAPSHOT.jar!/crfCoverPage2.jasper

at net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:117)

at net.sf.jasperreports.repo.InputStreamPersistenceService.load(InputStreamPersistenceService.java:48)

...

Caused by: net.sf.jasperreports.engine.JRException: Error opening input stream from URL : jar:file:/usr/share/tomcat6/webapps/edc/WEB-INF/lib/cm-persistence-3.1.0-SNAPSHOT.jar!/crfCoverPage2.jasper

at net.sf.jasperreports.engine.util.JRLoader.getInputStream(JRLoader.java:302)

at net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:112)

... 112 more

Caused by: java.io.FileNotFoundException: JAR entry crfCoverPage2.jasper not found in /usr/share/tomcat6/webapps/edc/WEB-INF/lib/cm-persistence-3.1.0-SNAPSHOT.jar

at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)

at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:132)

at java.net.URL.openStream(URL.java:1010)

at net.sf.jasperreports.engine.util.JRLoader.getInputStream(JRLoader.java:298)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...