JNDI help

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2007
Posts: 8
Reputation: sasidharnet is an unknown quantity at this point 
Solved Threads: 0
sasidharnet sasidharnet is offline Offline
Newbie Poster

JNDI help

 
0
  #1
Feb 20th, 2008
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

  1. import javax.naming.*;
  2. import java.rmi.*;
  3. import java.util.*;
  4.  
  5. public class UseJndi{
  6. public static void main(String args[]){
  7. try{
  8. Hashtable h = new Hashtable();
  9. h.put(Context.INITIAL_CONTEXT_FACTORY,
  10. "weblogic.jndi.WLInitialContextFactory");
  11. h.put(Context.PROVIDER_URL, "t3://localhost:7001");
  12. h.put(Context.SECURITY_PRINCIPAL, "admin");//user
  13. h.put(Context.SECURITY_CREDENTIALS, "inetadmin");
  14. Context ic = new InitialContext(h);
  15. System.out.println(" initial context = "+ ic);
  16. NamingEnumeration ne = ic.listBindings("");
  17. while (ne.hasMore()) {
  18. Binding b = (Binding)ne.next();
  19. System.out.println( b.getName());
  20. System.out.println(b.getObject());
  21. }
  22. }catch (Exception e){}
  23. }
  24. }

It is compiling and when I am trying to run this it is showing this problem

  1. E:\programs>java UseJndi
  2. Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/kernel/Kerne
  3. lStatus
  4. at weblogic.jndi.Environment.<clinit>(Environment.java:73)
  5. at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
  6. extFactory.java:117)
  7. at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
  8. at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
  9. at javax.naming.InitialContext.init(Unknown Source)
  10. at javax.naming.InitialContext.<init>(Unknown Source)
  11. at UseJndi.main(UseJndi.java:18)

please give reply to this problem.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC