Search code examples
lotus-domino

Locating JAR file used by agent


More than 20 years ago I created a Domino agent that calls Java code and uses JDBC to write information into a DB2 database. Despite its questionable quality this agent has been running since then and now needs to be migrated to a completely different platform because we are shutting down Domino completely.

The colleagues that are now in charge of the agent need to have that JAR in order to decompile it and analyze its behaviour.

Yes, I know sourcecode should be available in a repository, but it isn't ;-)

Yes, I know that this reverse engineering approach has some risks, but we don't have better options ;-)

Unfortunately we can't find the JAR file anywhere. From what I remember it was uploaded to the NSF file and is stored and handled by Domino.

What we already tried:

  • analyzed the Lotusscript code
  • checked the Java and JAR sections in the NSF file
  • looked into the filesystem of the server and searched for JAR files with a name that points into the direction of DB2 drivers or my DB access classes
  • listed the content of all JAR files and searched for the name of the class I know is used by the agent (DatabaseAccessToDb2)

We are on Domino 9, I don't remember which version of Notes I used while creating the agent.

Here are parts of the agent code:

Option Public
Option Explicit
Use "LinkRegistry"
Uselsx "*javacon"
Use "DB2 Connect"
Use "database"
Use "hilfe"
Option Base 0
...

Sub Initialize
      ...
      Call ConnectDB2( opendoc )
      ...
End Sub

Sub ConnectDB2( opendoc As NotesDocument )
      ...
      Dim DatabaseAccessToDb2 As JavaClass
      Set DatabaseAccessToDb2 = jsession.GetClass( "de.my.company.forms.database.DatabaseAccessToDb2" )

      Set db2 = DatabaseAccessToDb2.CreateObject
      Call db2.enableLog()
      db2.doInsert( "..." )
      db2.close
...
End Sub

This is the structure of the agent, we looked "everywhere" and couldn't find the compiled java code: structure

Where should the JAR file be located ? Are we searching for the wrong kind of file (I don't think WAR files are relevant) ? We checked SO posts like this one but they didn't bring us closer to a solution.


Solution

  • With an agent using LS2J as yours does, there are four places that the Java code could be, and code could be used from more than one of these places at once:

    • As source code in a script library, compiled when the script library is saved. You'll find this under "Src" after opening a script library in Designer;
    • As a jar file attached to a script library. You'll find this under "Archive" after opening a script library in Designer;
    • As a jar file in the Domino server file system (only if the agent runs on the server); or
    • As a jar file in the Notes client file system (only if the agent runs on Notes clients).

    You don't mention script libraries in your question. Check those first if you haven't yet done so.

    If Domino or Notes uses a custom jar file from the file system, the jar file can be in the jvm\lib or jvm\lib\ext subdirectory of the Domino or Notes installation directory, or in a custom location specified by the JavaUserClasses key in the appropriate Notes.ini file.