We have a Java agent which runs fine in a Notes R5 client, but does not seem to work in R6.
The agent populates a document with information about a user, obtained from the company’s LDAP directory. Relevent section of code follows:
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here
String userID = session.getEnvironmentString("Intranet_ID");
BluepagesLookup bp = new BluepagesLookup();
.
.
.
}
The agent makes use of classes contained in a shared Java library called “BluepagesLookup”. This shared library is included in the agent’s project (via the “Edit Project” button.)
The shared Java library contains the BluepagesLookup class, as well as two jar files: ibmjndi.jar, and jndi.jar. The jar files are included in the project for the shared Java library (again, via the “Edit Project” button.) It is my understanding that any archives which are included in this fashion will behave as though they are in the classpath. Following are the relevant sections of code:
import java.io.*;
import javax.naming.*;
import javax.naming.directory.*;
import java.util.*
public class BluepagesLookup extends Thread {
private DirContext ctx;
public BluepagesLookup() throws NamingException {
ctx = getContext();
}
public DirContext getContext() throws NamingException {
Properties props;
props = new Properties();
props.put("java.naming.factory.initial","com.ibm.jndi.LDAPCtxFactory");
props.put("java.naming.provider.url","ldap://myldapURL.ibm.com:389");
props.put("java.naming.ldap.version","2");
props.put("java.naming.security.authentication","none");
props.put("java.naming.factory.url.pkgs","com.ibm.jndi");
props.put("java.naming.referral","ignore");
props.put("java.naming.ldap.derefAliases", "never");
return new InitialDirContext(props);
}
.
.
.
}
This agent worked just fine with the Notes R5 (5.0.11) client). Now one of my customers went off and installed the R6 client, and is complaining that the agent no longer runs. I had him turn on the Java console, and this is what we see:
javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.jndi.LDAPCtxFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.jndi.LDAPCtxFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:513)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:445)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:220)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:57)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:661)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.java:231)
at javax.naming.InitialContext.<init>(InitialContext.java:207)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:92)
at BluepagesLookup.getContext(BluepagesLookup.java:116)
at BluepagesLookup.<init>(BluepagesLookup.java:23)
at JavaAgent.NotesMain(JavaAgent.java:52)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(NotesThread.java:208)
The class “com.ibm.jndi.LDAPCtxFactory” is a member of the ibmjndi.jar archive, so it should be in the classpath, in theory. But it appears the client cannot locate this class.
I tested by installing the Notes R6 client on another workstation, and the same thing happened.
I also tested on local copies of the database, on each of an R5 and R6 client. The R5 client copy ran just fine, while the R6 copy didn’t. This makes me believe it is related to the client, rather than anything happening on the Notes server.
Any ideas on why this is happening? Is this a bug with the Notes R6 client product, or my application?
Thanks,
Mike