Hi All.,
I have written a simple JNDI program in IBM RAD.While running its showing
"Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory " Exception. After that I have downloaded and included fscontext.jar in the libraries. But it`s showing another exception...
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jndi/toolkit/chars/CharacterEncoder
Here I am giving complete code.
package mypackage;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class NamingExample {
public static void main(String []l){
Hashtable environment=new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
try{
Context intialContext=new InitialContext(environment);
String name="D:\\sureshsai";
Object object=intialContext.lookup(name);
System.err.println("the name ... "+name+" is bound to "+object);
}catch (NamingException ne) {
System.err.println("naming exception was thrown... "+ne.getMessage());
}
}
}
Please help me to make the code runnable.
I have written a simple JNDI program in IBM RAD.While running its showing
"Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory " Exception. After that I have downloaded and included fscontext.jar in the libraries. But it`s showing another exception...
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jndi/toolkit/chars/CharacterEncoder
Here I am giving complete code.
package mypackage;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class NamingExample {
public static void main(String []l){
Hashtable environment=new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
try{
Context intialContext=new InitialContext(environment);
String name="D:\\sureshsai";
Object object=intialContext.lookup(name);
System.err.println("the name ... "+name+" is bound to "+object);
}catch (NamingException ne) {
System.err.println("naming exception was thrown... "+ne.getMessage());
}
}
}
Please help me to make the code runnable.