Tuesday, January 29, 2008

What is ENC

There is a difference between component namespace and appserver (global) namespace.

Each "component" has it's own ENC at java:/comp/env

When it declares a dependency, it binds it to a name in here, eg. java:/comp/env/ejb/SomeEJB
It looks it up using this name. It is up to the deployer to bind this name with the global appserver name of the required resource eg below of a sun-web.xml. The resource could physically be in another server.


jdbc/FooDS -- relative to java:/comp/env
jdbc/OracleDS -- global jndi name


They say directo global lookups are not portable because appserver global namespace is implementation-specific.

Mappend name in @Resource annotation is the global jndi name (gets rid of need for sun-web.xml). Name (has a default of classname/fieldname) is the name in java:comp/env

If you don't suppy a mappedname, and don't provide a mapping in xml, it will look up global jndi name which is the same as the resource dependency's name in java:comp/env

https://glassfish.dev.java.net/javaee5/ejb/compdependencies_xmlforum_nov15.pdf

No comments: