在ejb-jar.xml <ejb-ref> <description> an EJB reference to the Widget EJB(描述)</description> <ejb-ref-name>ejb/WidgetEJB</ejb-ref-name> <ejb-ref-type>session</ejb-ref-type> <home>com.dhc.WidgetHome</home> <remote>com.dhc.Widget</remote> </ejb-ref>
程序 Content ctx = new InitialContent(); Object h = ctx.lookup("java:/comp/env/ejb"); //环境变量是只读的,而且是当前ejb的本地变量. WidgetHome home = (WidgetHome)PortableRemoteObject.narrow(h,WidgeHome.class);