我想浏览我的服务器的 jndi 注册表(例如 jboss)并为每个 ejb 找到它的实现类。例如假设我有本地 bean
@Stateless(name="fooService")
public class FooServiceBean implements FooService () { ... }
and the interface
@Local
public interface FooService { ... }
我从 jndi 检索它:
Context ctx = new InitialContext();
Object obj = ctx.lookup("fooService");
现在的问题..我怎么知道 obj 是 FooServiceBean 的实例?
2013 年 9 月 25 日更新:到目前为止,我还没有发现这是可能的,实际上它是有道理的。JNDI 只托管接口。