tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: JNDI Datasource question
Date Mon, 02 Dec 2002 10:09:27 GMT

Hi Ron,

That is referring to a context configuration file.  You *always* need to 
set up your DataSources through the proprietary server configuration.  The 
stuff in the web.xml only defines the interface.  For instance, if you set 
up DBCP specific stuff in the web.xml file, your app would be dependent on 
running under Tomcat and be incompatible with every other app server.  JNDI 
is meant to provide a standard interface while allowing the vendor to 
provide a proprietary implementation.  That way, you get to code to a 
standard and you get to pick the vendor who provides the best 
implementation (by your own definition).  That provides for both standards 
*and* market competition.  Neat, eh?

See the following for context configuration files:

Also, look at admin.xml and manager.xml in CATALINA_HOME/webapps for reference.

I addition, Craig R. McClanahan pointed out the following when deploying 
via the manager app:

For the deploy command, simply include your context confgiuration file in
the WAR at "META-INF/context.xml".

In Tomcat 4.1, you can dynamically deploy a "context configuration file"
instead of, or along with your webapp.  Such a file can contain the
<Context> element, and all nested subelements, from what you would
normally put in server.xml, so you can indeed dynamically deploy an app
with a custom realm.


At 10:02 PM 12/1/2002 +0100, you wrote:
>A question to grow my knowledge:)
>On tomcat 4.1.12-LE-jdk14 deployment with java jsdk 1.4.1_01-b01 I have
>installed the two missing jar files from commons (dbcp and pool) and
>made the example from the documentation (/DBTest) work. Great work, well
>written and very clear.
>So my question. If I want to use DataSources I always need to change or
>add Contect (or defaultContext) in the conf/server.xml? According to the
>documentation I can define a Resource as:
><Context ...>
>   ...
>   <Resource name="jdbc/EmployeeDB" auth="Container"
>             type="javax.sql.DataSource"
>      description="Employees Database for HR Applications"/>
>   ...
>in server.xml or as
>   <description>Employees Database for HR Applications</description>
>   <res-ref-name>jdbc/EmployeeDB</res-ref-name>
>   <res-ref-type>javax.sql.DataSource</res-ref-type>
>   <res-auth>Container</res-auth>
>int web.xml of an application that is deployed. But where to I put all
>the values named in the ResourceParams entries if I want to declare them
>from the web.xml file?
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message