JasperReport: Subreport Resource not found

Questions and answers on developing, deploying and using plugins and JavaBeans

JasperReport: Subreport Resource not found

Postby ngervasi » Wed Dec 22, 2021 5:32 pm

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?
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: JasperReport: Subreport Resource not found

Postby ngervasi » Thu Dec 23, 2021 12:44 pm

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);
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: JasperReport: Subreport Resource not found

Postby ngervasi » Fri Feb 09, 2024 7:29 pm

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
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 10 guests