I have a java class that should transfer data from the current database to another server. To access the current database, it seems that Java needs a working Session
object:
public class EdgeServerConnection
{
public EdgeServerConnection(Session session) {
try {
// How to get the session into here?
Database db = session.getCurrentDatabase();
...
} catch(Exception e) {
}
}
}
The class should be called from a LotusScript agent, somehow like this:
Set session = New NotesSession
Set jsession = New JAVASESSION
Set connectionClass = jsession.GetClass("EdgeServerConnection")
Set connectionObject = connectionClass.CreateObject("(L/lotus/notes/Session;V)", session)
But this throws the error
LS2J: java constructor failed to execute
If I remove the Session parameter from both the constructor and the CreateObject call, the error goes away.
How can I get the agent session into the java class?
You can't work with Domino objects in Java class called by LS2J nor can you pass Domino objects as parameter.
Do all your work with Notes Domino classes in LotusScript and use Java classes for the tasks you really need to accomplish with Java only.
As an alternative, you can create an Java agent which does all the work. You can call the Java agent from LotusScript then.