directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject RE: Tomcat uses JNDI to load resources, including JSP pages
Date Mon, 05 Jan 2004 19:19:58 GMT
Quoting Robb Penoyer <rpenoyer@timgia.com>:

> Sorry for the confused note below. The web mail tool I use is 
> not very good. 
> 
> As Tim indicates, he is more than willing to share the code, 
> it is attached.
> 
> >> Tim,
> >> 
> >> I just thought I would pass that along. I know these two 
> guys and 
> >> hadn't discussed this topic with them before. I know they 
> >> would be both be very interested in some detail about how 
> you went 
> >> about setting up the Tomcat access to LDAP.
> 
> >OK. For actual webapps, I'd personally recommend against 
> >hooking stuff that would coming from in the WAR/EAR directly 
> >into Tomcat, since you're contravening Sun's standard 
> >mechanisms and creating a non-portable webapp. OTOH, it 
> >seems likely that if you wanted a "direct-connect" between 
> >Subversion/CVS and Tomcat, it shouldn't be too hard to make 
> >up a suitable JSR-88 client and go in through accepted 
> >channels.

This would probably be quite reasonable except for one minor detail ...
standalone Tomcat does not have any JSR-88 support at the moment.  That's a
fixable problem if someone wanted to go to the effort, but it would likely
overlap a lot of stuff that's happening in Geronimo already -- and it is a
non-trivial amount of work.

 That would give another advantage as well - it's 
> >extremely perilous to change class code on the fly in a 
> >system like Tomcat,

>From my experience, the better way to think about this is "don't even bother to
try" :-).  Since there is no such thing as ClassLoader.unloadClass(), the way
that servlet containers reload apps at all is to throw away the webapp class
loader and create another one.

> but JSR-88 can not only start and stop 
> >webapps, it can deploy multiple instances of webapps which 
> >may allow one to overlap the process better.
> 

Presuming your container's JSR-88 support actually does that, of course.

> >The DataSource resource I constructed doesn't come in via a 
> >URL to the webapp and thus the servlet getResource() method 
> >doesn't apply there. It's defined as a J2EE JNDI resource 
> >found via the standard JNDI path "java:comp/env". Nothing 
> >special is required to use it; all the magic is in the 
> >factory class that I made available to Tomcat. And there's 
> >not even a whole lot of magic there. You've seen the code, I 
> >think. The whole thing's maybe 3-4 pages long at most.
> 

I'm not clued in to the entire problem space you're trying to solve, but the
proposed DataSourceFactory certainly seems like a very reasonable way to create
a DataSource resource from configuration data stored in an LDAP server.  If
you're after portability, though, you've still got to deal with figuring out
how to integrate custom JNDI ObjectFactory classes into any arbitrary app
server, but Tomcat (at least) tries to make that task easy.

Craig McClanahan


Mime
View raw message