I don't know why I didn't think of that ... other than the hour and too much beer...
When I step through the code with the debugger I can see the exception(s) before TOH swallows them, and on the bright side I am able to step through the Groovy code.
Now that I have solved all the ClassRefNotFound exceptions (by copying ~13MB of class files into the mission directory) I am running into AccessControlExceptions. If I try to instantiate a Groovy class I get an AccessControlException inside the Groovy framework. I get the same exception (and stack trace) when I try to use RVEngine in a static method of a Groovy class. However, I can call static methods on the Groovy class and it works as long as I don't use any TOH objects (RVEngine, RVDirectories etc.). I tried deleting the files in beta/jre/lib/security but that didn't change anything.
Groovy does a lot of "magic" in the background and I suspect it is attempting something TOH isn't allowing, or at least isn't allowing users classes to do.
Here is my test code:
Code:
// In JSample.java
public class JSample {
public static Object staticTest1(Object[] args) {
GSample.staticMethod1(); // So far so good.
return null;
}
public static Object staticTest2(Object[] args) {
RVEngine.hint(GSample.staticMethod2(); // Works!
return null;
}
public static Object instanceTest1(Object[] args) {
GSample object = new GSample(); // AccessControlException
object.instanceMethod1();
return null;
}
public static Object instanceTest2(Object[] args) {
GSample object = new GSample(); // AccessControlException
String msg = object.instanceMethod2();
RVEngine.hint(msg);
return null;
}
}
// In GSample.groovy
class GSample {
static void staticMethod1() {
RVEngine.hint("Take on Groovy") // AccessControlException
}
static String staticMethod2() {
return "Take on Groovy" // Works
}
void instanceMethod1() {
RVEngine.hint("Take on Groovy") // Never gets this far.
}
String instanceMethod2() {
return "Take on Groovy" // Never gets this far.
}
}
And for completeness, the stack trace. However, since these are all Groovy classes it's likely not much help.
Code:
Java HotSpot(TM) Client VM[localhost:8008]
Thread [main] (Suspended (exception AccessControlException))
CachedClass$3(LazyReference<T>).getLocked(boolean) line: 54
CachedClass$3(LazyReference<T>).get() line: 33
CachedClass.getMethods() line: 250
MetaClassRegistryImpl.registerMethods(Class, boolean, boolean, Map<CachedClass,List<MetaMethod>>) line: 183
MetaClassRegistryImpl.<init>(int, boolean) line: 91
MetaClassRegistryImpl.<init>() line: 61
GroovySystem.<clinit>() line: 29
InvokerHelper.<clinit>() line: 49
ScriptBytecodeAdapter.initMetaClass(Object) line: 777
GSample.$getStaticMetaClass() line: not available
GSample.<init>() line: not available
JSample.instanceTest1(Object[]) line: 30