Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

JRI-Behaviour about compiling or not depending on whether only *.jasper, only *.jrxml or both type of files are in directory reports #25

#1

Hello Dietmar Aust,

we were used to drop both, *.jasper and *.jrxml files, into the directory ...\reports where JRI does expect them. Since using JRI 2.7.0 sometimes error messages come up:

(Windows Server 2012, tomcat 9.0.44, java 16, jri 2.7.0)

case 1: both types of files in dir. ...\reports:
error: Error compiling ...\reports\wart_planung_haupt.jrxml: Error saving file: ...\reports\wart_planung_haupt.jasper.
looks JRI trys to compile but there is already a *.jasper file and cannot overwrite. There were problems with windows access rights on all the JRI-directories, after solving that, the error appeared once then no more.

case 2: both types of files in dir. ...\reports:
error: in the browser there is something like a short flash as if a new page would be opened, next moment it is over and obviously nothing happened. Perhaps it is an error in our Apex- resp. Foex -app.

case 3: only *.jrxml files in dir ...\reports:
Resource not found at: stdwart_ladeliste_sub_uebers.jasper. as the file name suggests it is a subreport, so JRI has successfully compiled the main report, stdwart_ladeliste_haupt.jrxml to stdwart_ladeliste_haupt.jasper (I can see the file afterwards), but when reading the name of the subreport in the subreport object of the main report, is unable to open subreport stdwart_ladeliste_sub_uebers.jasper and does not compile stdwart_ladeliste_sub_uebers.jrxml

case 4: only *.jasper files in dir. ...\reports:
seems it does work

also the behaviour is not the same on different VMs, in other VMs there is no problem with keeping both files in ...\reports

Looks like I have to do some more debugging.

Fur further debugging I would appreciate you to say what I can expect:
a) if both type of files are in dir. ...\reports
b) if only *.jrxml files are in dir. ...\reports
c) if only *.jasper files are in dir. ...\reports
In which of the 3 cases JRI will try to compile the jrxml file to a jasper file?

Thanks for caring

Stephan Pickl, sellexx ag

  • replies 1
  • views 976
  • likes 0
#2

Hi Stephan,

you can find the actual code here, the function is compileJRXMLIfNecessary(): https://github.com/daust/JasperReportsIntegration/blob/main/src/main/java/de/oc/jasper/ReportUtilities.java

The basic concept is:

  • compilation is only required if jrxml file actually exists
  • compile if no .jasper exists or timestamp is older than that of the .jrxml file

This way you could just use the .jrxml files and everything will recompile on the fly.
If there are issues with recompiling subreports, we should look into it.

Certainly, when the reports are recompiled and written to the file again ... privileges are important. The Tomcat process must be able to write the .jasper file.

But you could also just use .jasper files ... or make sure the .jasper file has a newer timestamp than the .jrxml file. It should be this way anyway.