这个工作由EJB容器来完成,你就不必操心了。

解决方案 »

  1.   

    你的Hello bean 是一个远程接口的引用,并没有用new来实例化呀,这其实是EJB先通过jndi来查找可用的对象引用,然后再让skeleton(服务端)和stub(客户端)通过rmi协议来传输消息,否则远程接口bean怎么可能知道具体实现。 抛砖引玉!
      

  2.   

    我也刚学,不过这个例子,我做出来了。
    看这个http://www.csdn.net/develop/Read_Article.asp?Id=14181
    照着做就可以。
      

  3.   

    是不是我的例子中类HelloEJB实现了SessionBean,在容器中EJBObject被实例化,而我扩展了EJBObject接口,所以在容器中是我自定义的接口(就是那个扩展了EJBObject的接口)被实现并实例化,但容器并没有实现SessionBean,SessionBean是我实现的。而被容器实例化得到的HelloEJB型的对象操纵的是SessionBean对象,这样说对吗?但是getHello方法是被定义在EJBObject的子接口中的,为什么要在实现SessionBean的类里面实现?我看了ejb的包,SessionBean接口和EJBObject接口并不存在必然的联系阿!EJBObject是专门用来操作SessionBean而设计的吗?现在的主要问题是为什么Hello类型的对象可以调用HelloEJB中的方法!
      

  4.   

    这个我觉得你要有个整体概念,一个EJB实际上是由Home接口,bean接口,和bean实现共同组成。他们是紧密联系的,共同起作用。至于如何协调,则是由EJB容器自己管理的。
    所以你会觉得你调用的跟实际程序调用的好像不是同一个东西,但是结果确是一样的。
    总的来说这是一个规范,业界的统一标准。你要做的就是遵循这些规范
      

  5.   

    I hope it can help you.
       Bean client invoke methods on EJB objects,rather than the bean themselves.To perform this,EJB objects must clone every business method that your bean classes expose.But how do the tools that autogenerate EJB objects know which methods to clone?The answer is in a special interface that a bean provider writes.This interface duplicates all the business logic methods that the corresponding bean class exposes.This interface is called the remote interface.