Context myContext=new InitialContext(); is absolutely wrong!
should be
    Properties pro = new Properties();
    pro.put(InitialContext.INITIAL_CONTEXT_FACTORY,
            "weblogic.jndi.WLInitialContextFactory");
    pro.put(InitialContext.PROVIDER_URL, "t3://youpathtopb:7001");    Context ctx = new InitialContext(pro);maybe this is not suitable for you!

解决方案 »

  1.   

    String url = "t3://192.168.0.17:7001";
    String user = null;
    String password = null;
    Properties properties = null;
    try {
         properties = new Properties();
         properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
         properties.put(Context.PROVIDER_URL, url);
         if (user != null) {
             properties.put(Context.SECURITY_PRINCIPAL, user);
             properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
          }      Context myContext=new InitialContext(properties);
          }
          catch(Exception e) {
          }
      

  2.   

    构造InitialContext时候把properties当参数传进去。