tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Accessing resource in WEB-INF outside servlet
Date Mon, 08 Nov 2004 13:59:19 GMT


>Is using JNDI to access a file like this a reasonable approach? I just

It's an OK approach.  Not great, but not terrible either.  The reasons
it's not great are:
- It's heavyweight (JNDI resource binding and resolution is typically
several times more resource consuming than a static resource lookup via
either the classpath or the ServletContext).  But if done once to
initialize a variable, this is fairly negligible.
- It's container-dependent: you need something to do the JNDI binding
and lookups.  Running a small console app with this code becomes very
difficult. And unit testing it as-is becomes exceedingly difficult.
- It's awkward to change: you need to modify a container-specific
configuration file to change the entry.  This is both a pro and con,
though, as it means the server admin running your app can modify this
without needing programmer intervention.  

So it'll work, but the above merit consideration.


This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message