有没有更详细一点的代码片段,比如客户调用的代码,Home和Remote接口的声明什么的。

解决方案 »

  1.   

    客户端:
          //get naming context
          Context ctx = new InitialContext();      //look up jndi name
          Object ref = ctx.lookup("Test");      //cast to Home interface
          testHome = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
          testHome.create("123");  //这一步出错!
    什么iiop, smart agent我都启动了,还有其他原因吗?
      

  2.   

    啊我也在客户端遇到了问题
    我的EJB是1。0
    我的代码是这样
    //get naming context
          Context ctx = new InitialContext();
          //look up jndi name
          testHome home = ctx.lookup("testHome");//我的错误在这,根本找不到,如果注释掉这句以及后面关于EJB的部分,SERVLET可以运行!      //cast to Home interface
          //testHome = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
          testHome.create("123");  
      

  3.   

    Context contxt = getInitialContext();
    //Object ref = contxt.lookup("testHome");
    //testHome home = (testHome)PortableRemoteObject.narrow(ref,testHome.class);'
    testHome home = (testHome)contxt.lookup("test");
    // test testOk = home.create(); 
    java.io.PrintWriter out = response.getWriter();
    out.println("<HTML><HEAD></HEAD><body>");
    out.println("heheheh") ;
    // testOk.put("im","yeeee",999,1800,"ye");
    out.println("</body></HTML>");
      

  4.   

    如果是如下,就是纯servlet 了,可以运行良好。但是一去点//*******这行注释就运行不了
    Context contxt = getInitialContext();
    //Object ref = contxt.lookup("testHome");
    //testHome home = (testHome)PortableRemoteObject.narrow(ref,testHome.class);'
    //******* testHome home = (testHome)contxt.lookup("testHome");
    // test testOk = home.create(); 
    java.io.PrintWriter out = response.getWriter();
    out.println("<HTML><HEAD></HEAD><body>");
    out.println("heheheh") ;
    // testOk.put("im","yeeee",999,1800,"ye");
    out.println("</body></HTML>");
      

  5.   

    dhuwym(亦明) 兄能告诉我这需要启动什么服务啊?
      

  6.   

    客户端代码一般是不会有问题的,主要是部署和bean问题,如数据库能不能访问到?
    还有ejbCreate,ejbPostCreate 等是不是符合j2ee规范
      

  7.   

    我想知道的是你的EJB服务器是什么?
    另外,检查一下你的CMP实体bean类文件的代码编写是否符合EJB1.1规范,比如,是否有ejbPostCreate(),ejbCreate()和create()是否匹配?
    当然,我觉得有必要确定错误究竟是不是处在你说的地方。