Tuesday, January 14, 2003 03:09 PM
I get this same error, but only
(2) when I call the code from C++ through JNI, or
(3) when more than one thread is actively calling the code.
In other words, I don't get the error
(1) sometimes (!! yes, sometimes it just all works!),
(2) when I call the code from a Java test class, or
(3) when the C++ has only one thread calling JNI.
This is despite the facts that
(1) calls so new InitialContext() are synchronized, so no two threads call it at the same time,
(2) the two jar files (fscontext.jar and providerutil.jar) are present as extensions, in jre/lib/ext/, and
(3) I can successfully load the class using Class.forName and even instantiate an instance immediately prior to calling new InitialContext().
This last fact is particularly vexing. The only clue I can imagine is that it has something do with class loaders, but if the class has already been loaded, why would the JVM try to load it again? (And anyway, the extension loader should always find it.)
The stack trace looks like
Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory.
Root exception is
java.lang.ClassNotFoundException: com/sun/jndi/fscontext/RefFSContextFactory at
java.lang.Class.forName0(Native Method) at
Any ideas or clues will be greatly appreciated!