pro.put(InitialContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLIntialContextFactory");
pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001");

解决方案 »

  1.   

    你的程序不正确:
    import java.util.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;
    public class DataSourseTest {
      public DataSourseTest() {
      }  public static void main(String[] args){
        Connection con=null;
          Context context = getInitialContext();
         // Context ctx=new InitialContext(pro);
         // DataSource ds=(DataSource)ctx.lookup("my/oracle");// 你的这行代码也有问题
          DataSource ds=(DataSource)ctx.lookup("java:/comp/jdbc/oracle");// 
          System.out.println("2!!!!!!!!!!!");
          con=ds.getConnection();
          System.out.println("Connection is ok!");
         System.out.println(ds.getClass().getName());
        }catch(Exception e){
          e.printStackTrace();
        }finally{
          if(con!=null)try{con.close();}catch(Exception e){}
        }
      }
    private Context getInitialContext() throws Exception {
        String url = "t3://localhost: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);
          }      return new InitialContext(properties);
        }
        catch(Exception e) {
          log("Unable to connect to WebLogic server at " + url);
          log("Please make sure that the server is running.");
          throw e;
        }
      }
    }
    当然,我部知道你的具体的问题,和怎么配置的!!
    但是你要注意两点:
    (1)确定你的服务器合理的启动
    (2数据原正确的配置和要使用正确的java命名空间
      

  2.   

    我觉得是初始化试出的问题,你的环境属性改成:
    pro.put(InitialContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLIntialContextFactory");
    pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001");
      

  3.   

    pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001");
    我加上了这句 结果还是那个错误,,
    我的oracle server肯定启动了 基本的jdbc程序都可以用
      

  4.   

    ClassNotFoundException: weblogic.jndi.WLIntialContextFactory
    weblogic起了没
      

  5.   

    Weblogic 绝对起了!
    但我刚刚试了试 不启动weblogic 好象错误信息也一样可我在jb里配置wb了啊,,并且在jb里用weblogic platform server 8.x admin console
    能启动ie,,访问http://localhost:7001/console
      

  6.   

    和weblogic的通信有问题,请检查weblogic是否安装成功。
      

  7.   

    在up 1,2下吧,
    我的jbuilder9 安装文件才150m大,,是不是这个原因??
      

  8.   

    嘿嘿,我认为是weblogic.jndi.WLIntialContextFactory所在的包没有加载进来,
    Add External lib
      

  9.   

    http://download2.bea.com/pub/releases/810/server810_win32.exe
    我下的是这个版本
    安装文件有217mb
    蛇蝎男人) 谢谢你 能告我怎么Add External lib 么 谢谢
      

  10.   

    中午了 高手们吃饭休息的时候帮我look 一下
    so up!
      

  11.   

    weblogic.jndi.WLIntialContextFactory所在的包没有加载进来
    所以问题就是weblogic和jbuilder集成没配置好!缺CLASS