开发者

EJB, JNDI & ENC - real life scenario

I am preparing for the EJB certification and I am going thro the EJB 3.1 book (O'Reilly)

One of the ch开发者_StackOverflowapters discusses about JNDI, ENC and the EJB connections

Can some of you give me a real life scenario of these so that I can get a better understandin


JNDI in this scenario is used as a central location through which 'names' (a kind of URL) are routed to an EJB bean. Think of it how a Servlet is mapped to a URL.

If EJB beans are local to an application (e.g. they reside within the web module or within the EJB module of the same EAR), then you don't necessarily need to come into contact with JNDI. Namely, you'd probably use injection to get instances of your bean and no JNDI is needed then.

However, if you need to address an EJB bean in a remote server or if you want to lookup (a proxy to) a bean programmatically, you'd use its JNDI name and JNDI to get hold of it.

See this for some more info, including ENC: Declaring @Resource and @EJB at the class level in Java EE6

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜