Jasper Reports Plug-in and Sub-Reports

We’ve bumped in to another problem with the Jasper Plug-in. We’re trying to run a report with 5 sub-reports in it. It compiles and runs perfectly in I-Report but returns an error when trying to run the report through the servoy plugin. I have checked the folder path, sub-report paths, compiled each report seperately and even tried running it on different machines…
The error I get is :

java.lang.Exception: Class not found when loading object from file : C:\Program Files\Servoy\JasperReports\engineers_report.jasper
org.mozilla.javascript.JavaScriptException: java.lang.Exception: Class not found when loading object from file : C:\Program Files\Servoy\JasperReports\engineers_report.jasper

Can anyone provide a solution.
Thanks in advance,
-Vaj

Hi Vaj,

Is this solved?

If not, can you upload the JXML files?

Is enginers_report your ‘main’ report or a sub report. If it is your main report are you sure that your sub reports are compiled?

Hi Marcel,
Its not solved yet…
Yes, the engineers_report is the main report.
I have compiled each sub-report from iReport and I even compiled each of the sub-reports from the Servoy end by using the jasper plugin…
Also I tried running each sub-report individually from my servoy solution to see if it was a error in an sub-report but they all worked fine.
It just doesnt seem to work when they are run from the main engineers_report…
And the strange thing is it runs fine when run from iReport.
:?
I have attached all 6 reports. engineers_report is the main one the rest are sub reports.
Thanks,

Reports.zip (9.98 KB)

Apologies, I forgot to ask what your script looks like.

And, have you stepped through your debugger to see where the error comes from?

Hi Marcel,

var $parameters = new java.util.HashMap();
$parameters.put(‘engineers_report_id’,27)
$parameters.put(‘SUBREPORT_DIR’,‘\\192.168.1.15\JasperReports\’)

//Trying to compile subreports before running the main report
plugins.jasperPluginRMI.jasperCompile(‘\\192.168.1.15\JasperReports\engineers_report_subreport4.jrxml’,true)
plugins.jasperPluginRMI.jasperCompile(‘\\192.168.1.15\JasperReports\engineers_report_subreport3.jrxml’,true)
plugins.jasperPluginRMI.jasperCompile(‘\\192.168.1.15\JasperReports\engineers_report_subreport2.jrxml’,true)
plugins.jasperPluginRMI.jasperCompile(‘\\192.168.1.15\JasperReports\engineers_report_subreport1.jrxml’,true)
plugins.jasperPluginRMI.jasperCompile(‘\\192.168.1.15\JasperReports\untitled_report_2.jrxml’,true)

//Running the main report
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘engineers_report.jrxml’,null,‘view’,$parameters)

The above method is the attempts I’ve made to catch an error. First I have compiled the sub reports seperately before running the main report.
The script ran withou errors till it came to the line where the main report was run. The error was

java.lang.Exception: Class not found when loading object from file : C:\Program Files\Servoy\JasperReports\engineers_report.jasper
org.mozilla.javascript.JavaScriptException: java.lang.Exception: Class not found when loading object from file : C:\Program Files\Servoy\JasperReports\engineers_report.jasper

When that didn’t work I ran the sub-reports individually to catch an error or to make sure they were compiled incase my first attempt to compile them didnt work.

var $parameters = new java.util.HashMap();
$parameters.put(‘engineers_report_id’,27)
$parameters.put(‘SUBREPORT_DIR’,‘\\192.168.1.15\JasperReports\’)

//Running all reports starting from the last sub report.
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘engineers_report_subreport4.jrxml’,null,‘view’,$parameters)
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘engineers_report_subreport3.jrxml’,null,‘view’,$parameters)
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘engineers_report_subreport2.jrxml’,null,‘view’,$parameters)
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘engineers_report_subreport1.jrxml’,null,‘view’,$parameters)
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘untitled_report_2.jrxml’,null,‘view’,$parameters)

//Running the main report
plugins.jasperPluginRMI.jasperReport(‘spaceair’,‘engineers_report.jrxml’,null,‘view’,$parameters)

This returns the same error

java.lang.Exception: Class not found when loading object from file : C:\Program Files\Servoy\JasperReports\engineers_report.jasper
org.mozilla.javascript.JavaScriptException: java.lang.Exception: Class not found when loading object from file : C:\Program Files\Servoy\JasperReports\engineers_report.jasper

Thanks,

could the image(s) cause this:

“\\192.168.1.15\JasperReports\space-airconditioning-plc-logo.png”?

What happens when you change the timestamp to a date?

The error is a little vague I am afraid.

Hi,

I just checked again. The image exists.
When I first saw the error I thought it’s definitely the sub-reports not compiling…But was confused when I saw the same error when the sub-reports were compiled seperately. :?
Could this be a issue with the plugin, as the report runs fine in iReport?

I have attatched my console output so that you can have the full error description.

Thanks for your help,

console_output.txt (18.2 KB)

I honestly don’t know.

It looks as though the report itself is not recognized but that is very strange.

Unfortunately I don’t use/have the plugin so I can not really comment.

Maybe Scott or Paul can?

Strange indeed…
I have emailed Scott. Waiting for a reply.
Thanks for having a look :) Appreciate it very much.

Please file an issue in our online issue system, that’s the official way to get support for Jasper integration.

Thanks…Will do that now. :)

I think I had the same problem. For some reason that parameter name kept on directing to c:\ in my case.
Work around was to rename the parameter in jasper to subreportdir.
This worked for me.

Thanks for the reply,
I tried changing the parameter name as you said but still no luck :(

Why do you compile the reports using Servoy. I compile everything using ireport and then put them on the server.

Yer, I don’t usually compile them using the plugin… But in this case I thought it was a case of jrxml files not getting compiled…So I compiled them first before running the report. It didn’t do any help. :(

Was this ever solved? I am having the same issue…

It turned out to be a faulty installation of the plugin.

We Had to replace the jasper plug-in with the latest version, and it worked.
Found it quite strange as the newer version of the plug in had only new features added.
I recommend filing a support case. Then one of the Servoy engineers will look in to it and if its the same problem, they will repalce your version of the plugin with the latest.