Ok, I run out of ideas
I set up a complex report, based on a Servoy foundset, that used a subreport to show a list of related data (a sort of portal).
On my machine, both using developer and server, the report works flawlessly.
When I load the files in the test server I get the famous Jasper error: Could not load object from location : C:/Servoy52/application_server/jasper_reports/sections_12_revs.jasper
I double-checked the report and subreport: the $P{SUBREPORT_DIR} param is set to “./”, just like other 10 similar reports working on the same server without problems.
The subreport expression is: $P{SUBREPORT_DIR} + “sections_12_revs.jasper”
The path returned by the error is correct and the subreport file is actually present in the folder.
I’m attaching the reports: if anyone has any idea, because I’m stuck…
What I recommend is that you have a location on your development machine that also exists on the server. Set your server property report path in developer and in your production server to that path.
Don’t use the SUBREPORT_DIR param at all, and instead use the absolute path as a string.
jbader:
What I recommend is that you have a location on your development machine that also exists on the server. Set your server property report path in developer and in your production server to that path.
Don’t use the SUBREPORT_DIR param at all, and instead use the absolute path as a string.
I’m afraid I can’t: I develop on Mac and deploy on a Windows machine. Not to mention that I already have about a dozen of reports, all using subreports without any issue: there must be an explanation to this behaviour.
Well even if you develop on Mac and deploy on Windows you could have a Boolean parameter that says if you are in production or in development (passed from servoy) and the SUBREPORT_DIR’s expression could be gotten based on the value of that Boolean.
jbader:
Well even if you develop on Mac and deploy on Windows you could have a Boolean parameter that says if you are in production or in development (passed from servoy) and the SUBREPORT_DIR’s expression could be gotten based on the value of that Boolean.
It’s an option, indeed. Anyway I tried to hardcode the path, but I always get the same error (net.sf.jasperreports.engine.JRException: Could not load object from location)
And you are certain the file is present? Meaning you are referencing a .jasper file, but perhaps you only have a .jrxml file there instead?
Are you using Java for the report language or are you using Groovy? If groovy keep in mind that since groovy is loosely typed it can’t catch type errors during compiling, and so frequently if you have a scripting error in your report, that error will be hidden from you (meaning you won’t be told about it when you save or compile the report in iReport) until you go to run the report, and at that time you will get an exception. That exception is not always explicit as to what the problem is. In this case you could in fact have an issue with the subreport file.
jbader:
And you are certain the file is present? Meaning you are referencing a .jasper file, but perhaps you only have a .jrxml file there instead?
In production I only upload .jasper files: the file is there, I checked it (I also checked file permissions, just to be sure).
[quote=“jbader”
Are you using Java for the report language or are you using Groovy? If groovy keep in mind that since groovy is loosely typed it can’t catch type errors during compiling, and so frequently if you have a scripting error in your report, that error will be hidden from you (meaning you won’t be told about it when you save or compile the report in iReport) until you go to run the report, and at that time you will get an exception. That exception is not always explicit as to what the problem is. In this case you could in fact have an issue with the subreport file.[/quote]
I’m using Java: I didn’t know Groovy worked, too in combination with Servoy.
But if I have an error in the report it shouldn’t work in my enviroment too, right?
Note specifically the part quoted below, and the reference to the String datatype for the subreport_dir param (vs, for example java.net.url etc.):
When using the string property you have to use the absolute pathfor the report. That’s why you’re getting an error.
So for it to be seen on the server you need the whole path ie
“C:/…/…/sub_VA.jasper”
PS You can use groovy so long as the groovy jar is present and the jnlp file references it (use the chart and script version of the plugin). It doesn’t matter if you are using foundsets as the datasource or not. But I wouldn’t recommend using it per my previous comments. You can also use JavaScript BTW.
Note specifically the part quoted below, and the reference to the String datatype for the subreport_dir param (vs, for example java.net.url etc.):
When using the string property you have to use the absolute pathfor the report. That’s why you’re getting an error.
So for it to be seen on the server you need the whole path ie
“C:/…/…/sub_VA.jasper”
I tried every combination of absolute/relative paths and datatypes, but still no luck. This report is haunted
Try putting in some debug code to determine the directory where the report “should be”.
For example try to use the jasper report plugin to retreive the reports directory and print it out to compare to your expected values.
Thomas Parry:
Try putting in some debug code to determine the directory where the report “should be”.
For example try to use the jasper report plugin to retreive the reports directory and print it out to compare to your expected values.
Nice suggestion: using the previous setting (with the SUBREPORT_DIR param) the only difference was in slashes vs backslashes.
I hardcoded the path using the result of the plugin and I got:
jasper dir: C:\Servoy52\application_server\jasper_reports
WARN - Debug - Throwable
net.sf.jasperreports.engine.JRException: Could not load object from location : C:\Servoy52\application_server\jasper_reports\sections_12_revs.jasper
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:255)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:317)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:266)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:256)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:482)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2011)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeader(JRVerticalFiller.java:603)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeaders(JRVerticalFiller.java:523)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:250)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:923)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:85)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at com.servoy.plugins.jasperreports.JasperReportRunner.getJasperPrint(JasperReportRunner.java:326)
at com.servoy.plugins.jasperreports.JasperReportRunner.getJasperPrint(JasperReportRunner.java:109)
at com.servoy.plugins.jasperreports.JasperReportsProvider.runReport(JasperReportsProvider.java:468)
at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:369)
at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:353)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:81)
at org.mozilla.javascript.gen.c343._c0(printJasper:1626)
at org.mozilla.javascript.gen.c343.call(printJasper)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
at org.mozilla.javascript.gen.c343.call(printJasper)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:476)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3977)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3858)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$MethodExecutor.run(ClientPluginAccessProvider.java:548)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
ERROR - Debug - Throwable
net.sf.jasperreports.engine.JRException: Could not load object from location : C:\Servoy52\application_server\jasper_reports\sections_12_revs.jasper
at com.servoy.plugins.jasperreports.JasperReportRunner.getJasperPrint(JasperReportRunner.java:332)
at com.servoy.plugins.jasperreports.JasperReportRunner.getJasperPrint(JasperReportRunner.java:109)
at com.servoy.plugins.jasperreports.JasperReportsProvider.runReport(JasperReportsProvider.java:468)
at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:369)
at com.servoy.plugins.jasperreports.JasperReportsProvider.js_runReport(JasperReportsProvider.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:353)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:81)
at org.mozilla.javascript.gen.c343._c0(printJasper:1626)
at org.mozilla.javascript.gen.c343.call(printJasper)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
at org.mozilla.javascript.gen.c343.call(printJasper)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:476)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3977)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3858)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$MethodExecutor.run(ClientPluginAccessProvider.java:548)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception Object: java.lang.Exception: Could not load object from location : C:\Servoy52\application_server\jasper_reports\sections_12_revs.jasper
Of course I double checked: report sections_12_revs.jasper is actually present in "C:\Servoy52\application_server\jasper_reports' directory.
Maybe I have a clue: logging into server machine and launching a local client the report works.
It could be a problem related to Jasper Reports path set in the server? It looks correct (and still doesn’t explain why all other reports work), but it’s strange anyway.
Does the path on the server has a preceding slash? Otherwise it will be relative, not absolute and we have learned already that absolute is required when using type String for the subreport_dir param. Maybe the subtle difference is that your local developer has an absolute path as the server folder directory path, whereas production does not?
jbader:
Does the path on the server has a preceding slash? Otherwise it will be relative, not absolute and we have learned already that absolute is required when using type String for the subreport_dir param. Maybe the subtle difference is that your local developer has an absolute path as the server folder directory path, whereas production does not?
Very strange: it seems to be the opposite.
The path on the test server is C:\Servoy52\application_server\jasper_reports (not working)
The path on my development machine is /Applications/Servoy52/application_server/jasper_reports (working)
No, it’s not a privileges issue.
The weird thing is that if I start a client on the server machine the report works fine, if the client is started from a different machine we get the subreport error.
Brainstorming on this I’ve found the real issue: the subreport file is looked up LOCALLY, on client side. If I create the full path and place the file on the client machine the report works fine.
I’ll ask Riccardo to investigate why this is happening for this particular report and not for all the other reports that we have.
Does this help? From the Jasper Ultimate Guide for iReports, page 155:
You might be concerned about why a relative path cannot be used to locate the subreport file; in other words, why, if you have
a report in c:\myreport\main_report.jasper, you cannot refer to the subreport just by using an expression like
…\mysubreports\mysubreport.jasper. Well, you cannot do this because JasperReports does not keep in memory the original
location of the Jasper file that it’s working with. This makes perfect sense, considering that a Jasper object is not necessarily
loaded from a physical file.
Not sure if this is your problem but I had a similar issue when using the foundset method for creating jasper reports with a subreport. Works fine on developer locally but doesn’t work client/server.
Was told by Servoy that subreports simply do not work with the foundset method using current plugin. Subreports only work if you are loading the report with SQL and passing parameters.
I had to replace the subreport with list controls (which are easier anyway), but maybe not as flexible. Hopefully this is fixed in a later version of the plugin.
Not sure if this is your problem but I had a similar issue when using the foundset method for creating jasper reports with a subreport. Works fine on developer locally but doesn’t work client/server.
Was told by Servoy that subreports simply do not work with the foundset method using current plugin. Subreports only work if you are loading the report with SQL and passing parameters.
I had to replace the subreport with list controls (which are easier anyway), but maybe not as flexible. Hopefully this is fixed in a later version of the plugin.
That explains this odd behaviour. To be sure I launched the report from a webclient and it works just fine.
I can easily replace the subreport with a SQL query based one and see if it works or use a list instead (in this case the solution would be acceptable).
I’ll file a case for that and see what support team will tell me.