This is sasidhar.
I am getting problem with JNDI.
please help to solve this problem.
This is the program I used to work on JNDI.
I am using weblogic 10.0
import javax.naming.*;
import java.rmi.*;
import java.util.*;
public class UseJndi{
public static void main(String args[]){
try{
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
h.put(Context.SECURITY_PRINCIPAL, "admin");//user
h.put(Context.SECURITY_CREDENTIALS, "inetadmin");
Context ic = new InitialContext(h);
System.out.println(" initial context = "+ ic);
NamingEnumeration ne = ic.listBindings("");
while (ne.hasMore()) {
Binding b = (Binding)ne.next();
System.out.println( b.getName());
System.out.println(b.getObject());
}
}catch (Exception e){}
}
}
It is compiling and when I am trying to run this it is showing this problem
E:\programs>java UseJndi
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/kernel/Kerne
lStatus
at weblogic.jndi.Environment.<clinit>(Environment.java:73)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
extFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at UseJndi.main(UseJndi.java:18)
please give reply to this problem.