You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2002/07/11 00:53:16 UTC

RE: JNDI - What resources are loaded?


On Wed, 10 Jul 2002, Keith Wannamaker wrote:

> Date: Wed, 10 Jul 2002 18:14:12 -0500
> From: Keith Wannamaker <Ke...@Wannamaker.org>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: RE: JNDI - What resources are loaded?
>
> I'm creating a J2EE application that contains serveral web applications.
> Is there a portable J2EE way to set up serveral global parameters in JNDI
> that can be accessed by all the web apps?  Or, is it necessary to duplicate
> all the parameters in each webapp's deployment descriptor?
>
> If it were simply a group of webapps for tomcat, I'd just put the parms
> in the tomcat conf/web.xml file.  I guess a better way to phrase the
> question is, what is the preferred place for jndi parms in j2ee that
> are scoped for the entire application?
>

J2EE specs don't require the ability to share resources in this way, so
there's no portability guarantee.  But Tomcat 4.1.x supports this.  In
server.xml, you put the resources in a <GlobalNamingResources> section at
the top of the file (or use the admin tool to configure them).  Then,
inside the <Context> element for each webapp, you use a <ResourceLink>
element that, in essence, acts like a symlink in the file system and
points at the shared global resource.  For example, you could share a
single connection pool across webapps this way.

Of course, whether the resources are shared or not is something the server
administrator cares about -- as far as the application developer is
concerned, it always looks like a locally configured resource.  So you can
even do things like initially share a connection pool, then decide to give
a particular webapp its own connection pool instead, with zero impact on
the application itself.

> Thanks for any info,
> Keith
>

Craig


>
> | -----Original Message-----
> | From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> | Sent: Thursday, June 27, 2002 7:02 PM
> | To: Tomcat Users List; augustd@codemagi.com
> | Subject: Re: JNDI - What resources are loaded?
> |
> | You can certainly look at your own context, using the standard JNDI APIs
> |
> | For security reasons, you won't be able to see anybody else's context, or
> | modify the one that Tomcat sets up for you.
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JNDI - What resources are loaded?

Posted by Will Hartung <wi...@msoft.com>.
----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, July 10, 2002 3:53 PM
Subject: RE: JNDI - What resources are loaded?
>
>
> On Wed, 10 Jul 2002, Keith Wannamaker wrote:
> >
> > I'm creating a J2EE application that contains serveral web applications.
> > Is there a portable J2EE way to set up serveral global parameters in
JNDI
> > that can be accessed by all the web apps?  Or, is it necessary to
duplicate
> > all the parameters in each webapp's deployment descriptor?
>
> J2EE specs don't require the ability to share resources in this way, so
> there's no portability guarantee.  But Tomcat 4.1.x supports this.  In
> server.xml, you put the resources in a <GlobalNamingResources> section at
> the top of the file (or use the admin tool to configure them).  Then,
> inside the <Context> element for each webapp, you use a <ResourceLink>
> element that, in essence, acts like a symlink in the file system and
> points at the shared global resource.  For example, you could share a
> single connection pool across webapps this way.

The other potential option is to load these resources up on the J2EE side.
You can have "initialization" classes run on server startup, and those
classes should be able to populate the JNDI tree with their own entries.

Since most J2EE based servlets use the JNDI tree from the Appserver, this
should be shared across the seperate webapps.

This should be portable across both servlet and J2EE containers, though I've
never actually done this myself.

Lots of 'shoulds' in here, I haven't done this myself. It's just an idea.

Best Regards,

Will Hartung
(willh@msoft.com)




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JNDI - What resources are loaded?

Posted by Will Hartung <wi...@msoft.com>.
I guess that depends on what kind of resources you're using. JMS seems a
little bit heavyweight way to deal with this issue.

Why not simply have the resources returned from a Session Bean on the
appserver?

Regards,

Will Hartung
(willh@msoft.com)

----- Original Message -----
From: "Keith Wannamaker" <Ke...@Wannamaker.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, July 10, 2002 9:52 PM
Subject: RE: JNDI - What resources are loaded?


> Portability is an issue, so it seems the best way
> to effect global parms in J2EE is to designate them
> for one component (say a web app), then use JMS to
> communicate the values to the other components
> (web apps).  Does this seem like the portable way
> to attack this problem?
>
> Keith
>
> | -----Original Message-----
> | From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> | Sent: Wednesday, July 10, 2002 5:53 PM
> | To: Tomcat Users List
> | Subject: RE: JNDI - What resources are loaded?
> |
> |
> |
> |
> | J2EE specs don't require the ability to share resources in this way, so
> | there's no portability guarantee.  But Tomcat 4.1.x supports this.  In
> | server.xml, you put the resources in a <GlobalNamingResources> section
at
> | the top of the file (or use the admin tool to configure them).
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: JNDI - What resources are loaded?

Posted by Keith Wannamaker <Ke...@Wannamaker.org>.
Portability is an issue, so it seems the best way
to effect global parms in J2EE is to designate them
for one component (say a web app), then use JMS to
communicate the values to the other components 
(web apps).  Does this seem like the portable way
to attack this problem?  

Keith

| -----Original Message-----
| From: Craig R. McClanahan [mailto:craigmcc@apache.org]
| Sent: Wednesday, July 10, 2002 5:53 PM
| To: Tomcat Users List
| Subject: RE: JNDI - What resources are loaded? 
| 
| 
| 
| 
| J2EE specs don't require the ability to share resources in this way, so
| there's no portability guarantee.  But Tomcat 4.1.x supports this.  In
| server.xml, you put the resources in a <GlobalNamingResources> section at
| the top of the file (or use the admin tool to configure them). 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>