I'm working on a legacy Java application that has many compiled .jasper reports. Recently something changed with the way that the office IT company I work with is deploying the app, and reports stopped working, with the app no longer being able to find the reports on the filesystem. I updated the build so that the reports are included in the classpath
, and the FileNotFoundException
goes away.
Now however, reports are rendering only in part. Some parameters, headers basically any content that isn't related to a Scriptlet renders perfectly, but anything related to a Scriptlet renders only nulls.
There is only one way that I've found to fix this problem. If I put the .jasper files inline with the .java files and run the app dynamically through eclipse, then the Scriptlets also render correctly. If I load them from another location and run the app through eclipse, then the nulls return.
My distribution uses One-Jar to bundle my dependencies.
Can pathing effect Scriptlet rendering? I have confirmed that the md5 of the .jasper files match when loading inside and outside of eclipse, so I'm confident that the same file is being loaded in each case.
Jasper Reports is not compatible with the One-jar project.
It's not documented anywhere, but with the way that one-jar rewrites the path "prepending main" it won't be able to locate scriptlets. Unfortunately, Jasper seems to fail silently in this case.