I wanted to include a subreport which is fine as long as one does not reference/call the scriptlet via the $P{REPORT_SCRIPTLET}
multiple times:
<subreport>
...
<subreportExpression>
/* "/myrep.jrxml" */ /* runs fine */
/* $P{REPORT_SCRIPTLET}.getMyRepPath() */ /* returns the above and runs fine */
/* the report runs to the fill phase and may or may not (both experienced)
* after some time return and say, e.g. that the file has not been found
*/
$P{REPORT_SCRIPTLET}.dbg( "subreport: ", $P{REPORT_SCRIPTLET}.getMyRepPath() )
</subreportExpression>
</subreport>
It is based on the Jasper Utils EnvScriptlet
in case it gives a clue about the cause.
calling the static method directly in the 2nd invocation like this however works fine:
<subreport>
...
<subreportExpression>
$P{REPORT_SCRIPTLET}.dbg( "subreport: ", EnvScriptlet.getMyRepPath() )
</subreportExpression>
</subreport>