Page 1 of 1

JasperReport: Subreport Resource not found

PostPosted: Wed Dec 22, 2021 5:32 pm
by ngervasi
I've just migrated a very complex solution from Servoy 5.x to Servoy 2021.09, in the process I've updated JasperReports plugin to the latest 6.17.0.1, all my reports remained untouched (they were created in the old iReport 10 years ago).
Now when I try to print a report I get this error (in developer and server):

Code: Select all
ERROR com.servoy.j2db.util.Debug - Resource not found at: ./lf_offers_prt1_header1.jasper.


Reports and subreports are in the same folder: directory.jasper.report=/Applications/Servoy.app/Contents/application_server/jasper_reports

In the report I use this code for the subreport:

Code: Select all
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
      <defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
   </parameter>
...
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "lf_offers_prt1_header1.jasper"]]></subreportExpression>


It used to work perfectly but now it fails. I've read all the docs I've found to see if there was any change in the plugins but found nothing, does anyone have an idea about why it's breaking?

Re: JasperReport: Subreport Resource not found

PostPosted: Thu Dec 23, 2021 12:44 pm
by ngervasi
Problem solved.
To avoid someone else all the time I wasted on this, here's the solution.

Somehow in the last 10 years something has changed in the plugin and now the

Code: Select all
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
is not honored anymore.

The solution is to pass the parameter from Servoy:

Code: Select all
plugins.jasperPluginRMI.runReport(globals.sintpro_db_name,'lf_offers_prt1.jasper',null,'view',{ SUBREPORT_DIR: './' },_locale);

Re: JasperReport: Subreport Resource not found

PostPosted: Fri Feb 09, 2024 7:29 pm
by ngervasi
After more than 2 years I had the same problem again and didn't remember anything about it so I searched the forum...

I have to thank myself for being so kind to post the solution!
I saved myself a lot of time!! :D