看错误应该是初始化的时候就出错了,你要在jb里面设置ejb的jndi名的。

解决方案 »

  1.   

    执行时不在jb下,也不是用jb开发的,?!
      

  2.   

    要指定一个 url,以及另外一个属性的!Property props = new Property();
    .....
    InitialContext init = new InitialContext(props);
      

  3.   

    在client 加上porps 设置
    制定好CLASSPATH
    你在什么容器里面发布的?
      

  4.   

    Context ctx = new InitialContext();
      

  5.   

    我还。。你的EJB正确部署了吗是HOME 的还REMOTE的如果是REMOTE的,你lookup之前,指定了协议吗??
      

  6.   

    “InitialContext init = new InitialContext();”你这句不对,EJB在查找JNDI的时候需要先得到你的应用服务器的一些信息,你这样new根本没把应用服务器的信息告诉你的程序,你的程序又怎么知道该去哪找("JNDIName")这个名字呢?下面是我在用weblogic时得到环境的一个方法,你可以参考看看!
    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;
            }
        }
      

  7.   

    可以在服务器的控制台,看jndi数就知道是否已经绑定了.
      

  8.   

    有需要J2EE资料的吗?请访问我的网站http://softtrade.vicp.net 资料下载 目录下载资料
    内容:
    精通EJB2
    EJB-CMP-CMR
    J2EE_BlueprintsDigest
    JMS
    jAVA-jms
    ejb资料
    实战EJB
    J2EE and XML
    Enterprise Java Bean