users@glassfish.java.net

Re: Accessing JNDI resources from webapp

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Mon, 19 Apr 2010 19:48:21 +0530

You can refer :
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Resources2.html#64057

"The JNDI name of a resource and the name of the resource reference are
not the same. This approach to naming requires that you map the two
names before deployment, but it also decouples components from
resources. Because of this decoupling, if at a later time the component
needs to access a different resource, you don't have to change the name
in the code. This flexibility also makes it easier for you to assemble
J2EE applications from preexisting components."

Thanks,
-Jagadish

On Mon, 2010-04-19 at 15:27 +0200, Major Péter wrote:
> Hi,
>
> Why is that, that if I want to access a JNDI resource from a
> web/enterprise app, then I have to add to the web.xml a resource-ref? Is
> this really necessary?
> If I create a simple JAR library, which access to this JNDI resource,
> and add to the webmodule as a simple dependency (so it's not a module),
> then the library can access the resource without web.xml magic, probably
> because it's loaded by a different classloader then the main project is.
> So why does the resource-management works like this?
> I'm just asking..
>
> Regards,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>