Question

I am trying to learn Java EE and I have been reading for some time about JNDI, but beside some basic examples on the internet, and the same definition copied from place to place, I have found very little information that really explain the architecture. I need to know if my understanding is correct, then I have some questions:

My understanding:

JNDI

  • JNDI is an API that uses a service provider for implementation.
  • There are several implementations for JNDI: LDAP, File system, DNS etc. In addition each application server on the market comes with it's own implementation. For example JBoss comes with JBossNS
  • The implementation used by the application server is configured in a property file. I suppose default each server uses it's own JNDI implementation.

JNDI ENC

  • ENC is wrapper over JNDI previously mentioned used somehow for accesing local names
  • ENC is configured using annotations and/or xml files
  • ENC is then used by the injection mechanism to locate the resource and inject it

My questions:

  1. If I have multiple application servers, and I use application server JNDI implementation (ex JBossNS), do I configure all the other servers to use that JNDI implementation for that particular server? I am basically interested in enterprise architectural and how EJBs are found between servers.

  2. How do I configure ENC to inject remote objects found in another application server (different virtual machine). Do I use the "ejb-link" and use a global namespace for accessing the remote bean?

Related to answers, examples would be nice, and eventually links where JNDI architecture, and how the look-up is done would be helpful.

Thank you

Était-ce utile?

La solution

I will try to answer my own question, maybe it will be useful to someone.

First, related to JNDI, my understanding was correct. I found a really good link (I am not sure about Java EE version), but this one explained in detail how JNDI works:

http://ejbvn.wordpress.com/category/week-1-enterprise-java-architecture/day-04-using-jndi-for-naming-services-and-components/

Second question was related to ENC. I was partially right, however ENC is a context in the JNDI world (as defined in the context definition for JNDI). This context is mostly used as an aliasing purposes for being able to reference your container/module/application EJB no matter what the container is. So whenever you reference something from ENC, you are redirected to the proper resource, that can reside in another module/application/application server. Another link that was usefull to me is the one below. It contains several link so moake sure you read them all:

http://www.javacodegeeks.com/2011/08/ejb-programmatic-lookup.html

Regards

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top