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();
Map<String, Object> parameters = setUpParameters(trial.getId(), patientCRFData.getStage(), trial, crf, options);
InputStream io = this.getClass().getResourceAsStream("/crfTemplate.jasper");
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(io);
JRDataSource ds = new JRBeanCollectionDataSource(patientCRFs);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds);
JasperExportManager.exportReportToPdfFile(jasperPrint, fileName);
InputStream template = new DataInputStream(new FileInputStream(filePath));
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>
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..
I posted my code in the question. I had already tried to clean my work directory without success, I didn't try to clean the temp directory. I will try that.
Thanks for the reply