Invoking method on a Java class from lotus script (LS2J)
java, lotus-notes, lotusscript, ls2j
Solution
You are using the correct approach to calling your Java method but you can not pass Notes backend objects as parameters.
You can parse a string with the document universal id, for instance, and then in your Java method look up the document using the universal id.
Alternatively, migrate your Lotusscript logic to Java :-)
Problem
Most dignified developers, I'm having trouble invoking a method on my own java class from a lotus script agent. My Java class simplified looks like this ``` import lotus.domino.*; public class MyClass{ /* .. omitted constructor and other methods .. */ public void myMethod(Document doc){ /* ... do things with the document object ...*/ } } ``` Now this class is included with the proper use statement, and I can iterate over the classmethods on the class object in lotus script to get the signature of the arguments needed. But when I try to invoke the method I get a `LS2J: Parameter mismatch calling Method myMethod` I've tried both with dot notation on the JavaObject (No I'm not using a Mac ;)) and ADT ``` Dim doc as NotesDocument Dim jSession As JavaSession Dim jClass As JavaClass Dim jObject As JavaObject ... Set jSession = New JavaSession() Set jClass = jSession.Getclass("MyClass") Set jObject = jClass.Createobject() Call jObject.myMethod(doc) ``` and respectively ``` Dim jMethod as JavaMethod ... Set jMethod = jClass.Getmethod("myMethod", "(Llotus/domino/Document;)V") tmp = jMethod.Invoke(jObject,doc) ``` Also I've added error handling (OnError ..) to print out the results of any JavaError (+ stacktrace) but they end up empty so no further clues there. I'm using Designer version 9.0 Any ideas/pointers/gotchas? It's driving me bald.