Agent runs fine 8 times, then gets NoClassDefFoundError

Hi All,

 I read all 65 postings under search keyword NoClassDefFoundError and got some ideas, but no one seems to have experienced exactly the odd phenomenon I am encountering.



 The actual specifics of how I am using Java shouldn't matter -- LotusScript agent using LS2J to run a separate Java program (utilizing WebSphere MQ classes) residing in a Java script library in the same Notes database.  



I need a whole slew of IBM MQ JAR files to make this work, but gave up on the JavaUserClasses notes.ini parameter because the number of JAR files (and the full path to each of them) is monstrously long and I read that there is a 255 byte (give or take) limit on the length of the JavaUserClasses parameter (though I have not verified this myself).



Experimentation taught me that Notes client and Domino server simply ignore the system classpath (which I find hard to believe and wonder if I missed something).  So in the end, I went with the "include in the project" technique of enabling my Java code to locate the JAR files it needs.  Note also that my system classpath still refers to all the same JAR files as I have included in my project.    



Everything compiles okay and I can run my code.



Here is where it gets weird.  I can successfully run my agent about 8 or so times and then all of a sudden Domino flips out and issues a NoClassDefFoundError error message citing its inability to locate javax/resource/resource/ResourceException (which I tracked down to connector.jar, one of the JAR files included in the project).



 It seems to be some kind of class loader issue, but why/how?

Thanks in Advance,

Ken

Subject: Resolved: Agent runs fine 8 times, then gets NoClassDefFoundError

Hi,

I am not sure if this is the best solution, but what I did that worked is:

  1. I copied all the JAR files to the program directory C:\Lotus\Notes on my PC (where Notes, Designer, and Administrator clients run) and C:\Lotus\Domino on the server (where Domino runs).

  2. I updated the JavaUserClasses parameter in the notes.ini files on both computers to list all the JAR files by name, but left off the full path to them. [Apparantly, Notes/Domino will look in the program directory by default.] It looks like this now…

JavaUserClasses=connector.jar;fscontext.jar;jms.jar;jndi.jar;jta.jar;ldap.jar;providerutil.jar;com.ibm.mqjms.jar;.

  1. I removed, via Designer, the JAR files from the project where my Java code resides in a Java script library, all except the one, com.ibm.mq.jar, that I needed to get it to compile because my Java class directly calls classes residing in this JAR file.

  2. I restarted the Domino server and logged off and back on my PC to enable the notes.ini change to take effect.

The steps above show that I needed to configure my PC to match the Domino server machine. This is because I found that when testing an app via Notes or Designer, it doesn’t matter if the database resides on the server (not a local copy), Notes/Designer looks locally on my PC for Java classes.

Ken