So this is the very simplified Lotus Domino Java agent code I am trying to run...
import lotus.domino.*;
enum SingletonTest {
INSTANCE;
public void helloWorld() {
System.out.println("Hello World");
}
}
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
System.out.println("Started");
SingletonTest.INSTANCE.helloWorld();
System.out.println("Done");
} catch(Exception e) {
e.printStackTrace();
}
}
}
But when I try to run it this is what appears on the Java Console...
Started
Exception in thread "AgentThread: JavaAgent" java.lang.VerifyError: JVMCFRE028 ldc* bytecode must reference a constant; class=, method=valueOf(Ljava/lang/String;)LSingletonTest;, pc=0
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at java.lang.ClassLoader.defineClass(ClassLoader.java:212)
at lotus.domino.AgentLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at JavaAgent.NotesMain(JavaAgent.java:17)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
I am using Java 1.6 for my agent. I am using v8.5.3 FP3 and in my notes.ini I have..
JavaCompilerTarget=CurrentJavaVersion
So what am I doing wrong?
Is there a problem with the IBM Java version class loader using an enum that contains code?
This is the singleton coding pattern I have tried to follow...
https://stackoverflow.com/a/71399/2530065
edit: I probably should add I am running this as a Notes client agent with "Trigger:On event:Action Menu selection" and "Target:None".
edit2: So I have tested this exact code in a standalone Java program using the same IBM JRE/JVM and the code works perfectly without any issues. I just can't seem to get it to work as a Java agent within the Notes client.