tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "neal" <>
Subject RE: DBCP Woes! Ahaa!
Date Wed, 30 Oct 2002 09:35:15 GMT
Thanks for all the info.  Yeah, I'm using 4.0.4 so I guess that resources
link won't work. Too bad.  I will take a look at the default context though.
That sounds like it fits my scenario perfectly.



-----Original Message-----
From: Craig R. McClanahan []
Sent: Tuesday, October 29, 2002 10:16 PM
To: Tomcat Users List
Subject: RE: DBCP Woes! Ahaa!

On Tue, 29 Oct 2002, neal wrote:

> Date: Tue, 29 Oct 2002 18:48:20 -0800
> From: neal <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: RE: DBCP Woes! Ahaa!
> I figured it out ... well ... sort of.
> My primary content is  But, I also configured,
>, etc to all point to  It turns out that the
> I was getting the JDBC not bound to Context error, were the times I was
> going to the alternat domains, not!
> Ok, so that is the issue!  Pheew!  BUT, here's another question.  Must I
> configure DBCP in every single one of those other hosts?  I was hoping I
> could jsut switch crossContext=true on the Context containing the correct
> setup.

The crossContext attribute has nothing at all to do with JNDI resources --
it only determines whether the ServletContext.getContext() method will
unconditionally return null or not.  See the documentation (hyperlink
listed below) for more details.

JNDI resources for each <Context> must be configured individually.  If you
are using Tomcat 4.1, there is a mechanism to share the physical resources
themselves (such as a JDBC data source) by defining the resources in the
<GlobalNamingResources> section at the top of server.xml, and then using a
<ResourceLink> element nested inside each <Context> element that links to
it (analogous to a symbolic link in a filesystem).

> Perhaps for this to work the contexts must all be nested within the
> same host? But to have different urls resolve the only way I know to do
> is via a seperate host node, per domain:
>       <Host name="" appBase="webapps/hotel">
>           <Context path="" docBase="" debug="5"/>
>       </Host>
> Any thoughts?

Are all (or most) of the domain names supposed to resolve to the exact
same set of webapps?  If so, you're probably best off using the
"defaulthost"  capability of the <Engine> element:

    <Engine name="Standalone" defaulthost="">
        <Host name="" appBase="webapps/hotel">
        <Host name="" appBase="...">

In this scenario, any request received by this Tomcat instance, for any
unrecognized host name will be forwarded to the domain.  You can
explicitly list the separate hosts that should not be shared, as
illustrated with the "" entry above.

For more info about all of the server.xml options, see the docs included
in the standard Tomcat distribution at:


or online:

> Thanks everyone for your help!!!!
> Neal


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

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

View raw message