Hi,
We have a report script that does a lot of iterative and recursive deletion of connections, assignments, object occurrences, object definitions and models. This script is running ok on most content states (set of connections, assignments, object ocurrences, object definitions and models) of my database. However, we have now met a state in which the script fails.
The script fails calling
CxnDef.Delete(false)
This call returns false and throws exception with the collowing call stack:
report-engine-exception: An error occurred in the report object model. Cannot save modified objects in read-only mode. at com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.AArisReportRoot.saveModifiedObjects(Unknown Source) at com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.AArisObject.deleteArisObject(Unknown Source) at com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.ACxnDef.Delete(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335) at script(<our iterative code calling CxnDef.Delete(false)>) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401) at com.idsscheer.report.execution.javascript.AScriptContextFactory.doTopCall(AScriptContextFactory.java:226) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173) at com.idsscheer.report.execution.debugger.backend.AScriptDebugger.startScript(AScriptDebugger.java:162) at com.idsscheer.report.execution.interpreter.AJReportDebugger.executeReport(AJReportDebugger.java:134) at com.idsscheer.aris.server.bl.logic.webreport.scripting.AJavaScriptReportThread.run(Unknown Source) at com.idsscheer.aris.server.bl.logic.webreport.scripting.AJavaScriptDebuggerThread.run(Unknown Source) at java.lang.Thread.run(Thread.java:722) report-engine-exception: An error occurred in the report object model. Cannot save modified objects in read-only mode. at com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.AArisReportRoot.saveModifiedObjects(Unknown Source) at com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.AArisObject.deleteArisObject(Unknown Source) at com.idsscheer.aris.server.bl.common.reportobjects.aris.logic.ACxnDef.Delete(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335) at script(<our iterative code calling CxnDef.Delete(false)>) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401) at com.idsscheer.report.execution.javascript.AScriptContextFactory.doTopCall(AScriptContextFactory.java:226) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173) at com.idsscheer.report.execution.debugger.backend.AScriptDebugger.startScript(AScriptDebugger.java:162) at com.idsscheer.report.execution.interpreter.AJReportDebugger.executeReport(AJReportDebugger.java:134) at com.idsscheer.aris.server.bl.logic.webreport.scripting.AJavaScriptReportThread.run(Unknown Source) at com.idsscheer.aris.server.bl.logic.webreport.scripting.AJavaScriptDebuggerThread.run(Unknown Source) at java.lang.Thread.run(Thread.java:722)
Here I have simplified the call stack by replacing our code frames with "<our iterative code calling CxnDef.Delete(false)>".
Also, restoring the database to state before the failing code was run, we are able to run a much simple report script that only retrieves the "troublesome" connection definition by GUID and deletes it with the same call as above. This script's return value of CxnDef.Delete(false) is indeed true.
Finally, restoring the database to its initial state once more and in the failing code replacing CxnDef.Delete(false) by calls to CxnDef.Delete(true) and CxnDef.Delete() yields the same call stack as with CxnDef.Delete(false).
Is there anyone who may shed some light on what is going on here? I.e. the connection triggering the exception is possible to delete manually by being logged in to the database with the same credentials as when running the script. Is it e.g. possible that our custom code that executes prior to the failing CxnDef.Delete(false) may confuse the report engine and the iterative code to fail? Since the simpler code that only retrieves the connection definition by GUID and then deletes does not fail this seems like a plausible cause here. If this is the case, however, can anyone point us in the direction of a solution to our problem?
Regards,
Jens Ivar
Hi Jens,
it looks like you have opened the database in read-only mode, so you cannot store any modifications.
This can have 3 reasons:
1. the script has been run on a submitted changelist of a versioned database
2. the executed script is defined as a read-only script on the first page of its properties
3. inside the script you have opened a DB in read-only mode. The deletion takes place on an object of this database.
BR, Torsten