Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jndi - can't find  RSS feed

 
Charlie Swanson
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to locate the initial context factory, and I am receiving the error: ClassNotFound for com.sun.jndi.fscontext.RefFSContextFactory.
I have reinstalled SDK1.4 the most current version of Java. I cannot seem to locate the jndi files on my system. I have performed a scan for jndi and I found nothing. Does anyone have any suggestions?
Sincerely,
Charlie
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class jndiTest {
static String name;
public static void main(String args[]) {
if (args.length > 0) name = args[0];
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory" );
try {
// Create the initial context
Context ctx = new InitialContext(env);
// Look up an object
Object obj = ctx.lookup(name);
// Print it
System.out.println(name + " is bound to: " + obj);

} catch (NamingException e) {
System.err.println("Problem looking up " + name + ": " + e);
}
}
}
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your installation to see if fscontext.jar is anywhere in your CLASSPATH. I don't believe it comes bundled with J2SE1.4 even though the JNDI package is bundled.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!