I designed a report in iReport that has a straight forward query as the main report and a sub report with another simple query. Neither query has any parameters passed to it, however they both deal with timestamps extensively.
The combined report runs fine within iReport and if i remove the sub-query and load both into JasperReports Server they will run independently. However, when I try to run the full report that includes the sub-report, I get the following error and stack trace:
The server has encountered an error. Please excuse the inconvenience.
Error Message
net.sf.jasperreports.engine.JRRuntimeException: Parameter "DATABASE_TIMEZONE" does not exist.
Error Trace
net.sf.jasperreports.engine.JRRuntimeException: Parameter "DATABASE_TIMEZONE" does not exist.
at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.getValueParameter(JRAbstractQueryExecuter.java:606)
at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.getValueParameter(JRAbstractQueryExecuter.java:621)
at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuter.getValueParameter(JRTimezoneJdbcQueryExecuter.java:150)
at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuter.<init>(JRTimezoneJdbcQueryExecuter.java:134)
at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuterFactory.createQueryExecuter(JRTimezoneJdbcQueryExecuterFactory.java:50)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:728)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:629)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1159)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:802)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:746)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:640)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205)
at java.lang.Thread.run(Thread.java:619)
This is is a known bug as far as I can tell, but isn’t receiving much attention. Has anyone encountered this error and come up with a workaround or at least an explanation of what is going on?
Just so that this question has an answer:
My solution was to modify my SQL query to return all my data in one query and remove the sub-report. This seems like a silly work around for a fairly important feature but it is working in the meantime.