什么错呀? 你不说谁知道呢??? ------------------------------------------------------
           我们还年轻牛奶会有的奶牛也会有的 
             可天天在 csdn 混这些会有吗 ??

解决方案 »

  1.   

    可能是:lookup(“list”)的问题,要看你的EJB部署描述符中的JDNI名字是怎么配置的,比如是“ejb/list”那么可以使用lookup("list");
    还有也可能根InitialContext有关如果你的ejb容器使用的是weblogic可以这样:
        String url = "t3://localhost:7001";
        Properties properties = null;
          properties = new Properties();
          properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
          properties.put(Context.PROVIDER_URL, url);
          Context ctx = new InitialContext(properties);
      

  2.   

    String url = "t3://localhost:7001";
        Hashtable props = new Hashtable();
          props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
          props.put(InitialContext.PROVIDER_URL, url);
          //props.put Add User&Pass here
          Context ctx = new InitialContext(props);
          Object  home=ctx.lookup("list");  
          listHome  listHome=(listHome)home;  
          list  list=listHome.create();  
          return list.toString();
      

  3.   

    客户端代码:   Context  ctx=new  InitialContext();  能不出错吗?本机上客户端和服务器在同一个jvm里面,客户端搬到别的机器二者的jvm不同了。解决方法同  fdyxjh(淘汰狼)
      

  4.   

    //props.put Add User&Pass here使用如下:
    env.put(InitialContext.SECURITY_PRINCIPAL,"system");
    env.put(InitialContext.SECURITY_CREDENTIALS,"weblogic");