props.putContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.
NamingContextFactory");   这句有错误吧?最少括号,只有一边,既然能编译过去,强!
不如这么写:Context ctx =new InitialContext();
Object h = ctx.lookup("HelloWorld");
HelloHome home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(h,HelloHome.class);Hello hello=home.create();
        System.out.println(hello.hello());
        hello.remove();

解决方案 »

  1.   

    props.putContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.
    NamingContextFactory");   
    这句有错误同时,必须注意:Object obj=ctx.lookup("HelloHome");一句中的HelloHome必须是EJB中部署描述中的jndi-name 而不是你的home接口名
      

  2.   

    附:
    Jarky(武阳松清) 的Context ctx =new InitialContext();是程序中最常用的Context语句,比用
    props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.
    NamingContextFactory");   
    props.put(Context.PROVIDER_URL,"localhost:1099");