没有加载weblogic的jndi驱动。
你把你的weblogic.jar加到classpath中就ok了

解决方案 »

  1.   

    已经加了,而且还在jb中加了个包含weblogic的library,工程属性的required library中选中了。刚开始做ejb的例子,请多多指教
      

  2.   

    Hashtable ht=new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory")应该是这样的吧。
      

  3.   

    直接写默认就是当前你的EJB服务器的JNDI上下文.
     Context context = new InitialContext();如果是访问别的WLS ,可以这样写:
            properties = new Properties();
            properties.put(Context.INITIAL_CONTEXT_FACTORY,
                           "weblogic.jndi.WLInitialContextFactory");
            properties.put(Context.PROVIDER_URL, EJBSERVERURL);
            properties.put(Context.SECURITY_PRINCIPAL, EJBUSERNAME);
            properties.put(Context.SECURITY_CREDENTIALS, EJBPASSWORD);        Context context = new InitialContext(properties);
      

  4.   

    谢谢各位,jndi没问题了,编译通过,不过deploy 时不论是实体还是会话bean 都有unable to connect server t3://sea:7001 as user weblogic(如题)的错误,我想是不是设置有问题,请各位帮忙看看,分不够再加。
      

  5.   

    用户名:weblogic 用户不对或是没有权限访问你的WLS.你写了那么多是画蛇添足.
    只写一句试试,
    Context context = new InitialContext();如果不行就写全了吧.
          String EJBSERVERURL = "t3://sea:7001";
          String EJBUSERNAME = "weblogic登陆名";//如果有NULL表示WLS默认USER用户。      String EJBPASSWORD = "weblogic密码";//如果有NULL表示WLS默认USER用户的密码。      Properties properties = null;
              properties = new Properties();
            properties.put(Context.INITIAL_CONTEXT_FACTORY,
                           "weblogic.jndi.WLInitialContextFactory");
            properties.put(Context.PROVIDER_URL, EJBSERVERURL);
            properties.put(Context.SECURITY_PRINCIPAL, EJBUSERNAME);
            properties.put(Context.SECURITY_CREDENTIALS, EJBPASSWORD);        Context context = new InitialContext(properties);
      

  6.   

    登陆名不正确,用weblogic的登陆名和密码
      

  7.   

    t3://sea:7001里的sea最好打上所要发布机器的IP地址。
    应该可以了。
      

  8.   

    看看你的Server配置里面是否加了weblogic.jar。