You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rasputin <ra...@idoru.mine.nu> on 2003/03/25 20:47:51 UTC

cross-context DataSource?

Is this doable? Or even a good idea?

I've had success with postgresql and the JNDI datasource
howto (if someone wants to remove the 'untested' disclaimer for pgsql from the HOWTO,
feel free, though I haven't done much else with it yet).

It's a bit of a pain to reproduce this for each context, though - is it something that
can be defined at the <Host> level?

-- 
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: cross-context DataSource?

Posted by Jacob Kjome <ho...@visi.com>.
context.xml in META-INF only applies to deploying a webapp via the Ant 
manager taskdef deploy task.  If the .war is not getting copied to a 
directory of the same name as the .war file (less the .war extension), that 
means you have a <Context ...> entry defined somewhere either in server.xml 
or in a context configuration file in the webapps directory.  Actually, it 
is entirely possible that Tomcat is looking at
META-INF/context.xml even for the case of just copying the .war into the 
webapps directory.  I guess I never tried that.  Either way, if you define 
a <Context ...> for your app, the .war will *not* be expanded to a 
directory structure.  Don't define a <Context ... > entry and it *will* get 
deployed to a directory structure by default.

Jake

At 05:06 PM 3/26/2003 +0000, you wrote:
>* Rasputin <ra...@idoru.mine.nu> [0332 13:32]:
>
> > * Jon Archer <jo...@perceptive.com> [0330 20:30]:
> > > Certainly do-able. I have done so in two ways: either by putting my
> > > datasource in under a DefaultContext (using the tomcat admin tool click
> > > on  Tomcat Server --> Service --> Host, choose create DefaultCOntext
> > > from dropdown list of actions on RHS, then create a DataSource against
> > > the new DefaultContext)
> >
> > Hmm, me and the admin app aren't on speaking terms after it ate my
> > lovingly-crafted server.xml and crapped out something simlar but invalid
> > back around 4.1.12...
> >
> > > or, alternatively like this:
> > > http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg88811.html
> >
> > That's great, cheers Jon!
>
>Ugh, spoke too soon.
>
>I've obviously missed something because I get the infanous
>"cannot load JDBC driver name 'null'" - error.
>
>I went for the global resources and context.xml in META-INF path, if that
>makes a difference.
>
>The only thing I can think might be related is that I'm deploying webapps
>by copying wars to webapps/ and they don't get extracted , not sure
>if  that messes up the code that handles resources forwebapps.
>
>If I went down the DefaultContext route, would that generate a datasource
>in each Context that 'inheritsfrom it, or would it be truly shared?
>'
>--
>The trouble with a kitten is that
>When it grows up, it's always a cat
>                 -- Ogden Nash.
>Rasputin :: Jack of All Trades - Master of Nuns
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Re: cross-context DataSource?

Posted by Jon Archer <jo...@perceptive.com>.
<snip>

> 
> Ugh, spoke too soon.
> 
> I've obviously missed something because I get the infanous
> "cannot load JDBC driver name 'null'" - error.
> 
> I went for the global resources and context.xml in META-INF path, if that
> makes a difference.
> 
> The only thing I can think might be related is that I'm deploying webapps
> by copying wars to webapps/ and they don't get extracted , not sure
> if  that messes up the code that handles resources forwebapps.

That definitely makes a difference although I must confess I don't fully
understand why, suffice to say when I tried copying a WAR to webapps/
that didn't work for me either. I use the Ant deploy task and it works a
treat. Not sure quite what the approach would be to make this work if
you want to drop your WAR file in by hand as you are...anyone?

> 
> If I went down the DefaultContext route, would that generate a datasource
> in each Context that 'inheritsfrom it, or would it be truly shared?
> '

I believe it to be truly shared -- I don't think you'll see a DataSource
get created in each new context.

Cheers,
Jon

> -- 
> The trouble with a kitten is that
> When it grows up, it's always a cat
> 		-- Ogden Nash.
> Rasputin :: Jack of All Trades - Master of Nuns
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: cross-context DataSource?

Posted by Rasputin <ra...@idoru.mine.nu>.
* Rasputin <ra...@idoru.mine.nu> [0332 13:32]:

> * Jon Archer <jo...@perceptive.com> [0330 20:30]:
> > Certainly do-able. I have done so in two ways: either by putting my
> > datasource in under a DefaultContext (using the tomcat admin tool click
> > on  Tomcat Server --> Service --> Host, choose create DefaultCOntext
> > from dropdown list of actions on RHS, then create a DataSource against
> > the new DefaultContext)
> 
> Hmm, me and the admin app aren't on speaking terms after it ate my
> lovingly-crafted server.xml and crapped out something simlar but invalid
> back around 4.1.12...
> 
> > or, alternatively like this:
> > http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg88811.html
> 
> That's great, cheers Jon!

Ugh, spoke too soon.

I've obviously missed something because I get the infanous
"cannot load JDBC driver name 'null'" - error.

I went for the global resources and context.xml in META-INF path, if that
makes a difference.

The only thing I can think might be related is that I'm deploying webapps
by copying wars to webapps/ and they don't get extracted , not sure
if  that messes up the code that handles resources forwebapps.

If I went down the DefaultContext route, would that generate a datasource
in each Context that 'inheritsfrom it, or would it be truly shared?
'
-- 
The trouble with a kitten is that
When it grows up, it's always a cat
		-- Ogden Nash.
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: cross-context DataSource?

Posted by Rasputin <ra...@idoru.mine.nu>.
* Jon Archer <jo...@perceptive.com> [0330 20:30]:
> Certainly do-able. I have done so in two ways: either by putting my
> datasource in under a DefaultContext (using the tomcat admin tool click
> on  Tomcat Server --> Service --> Host, choose create DefaultCOntext
> from dropdown list of actions on RHS, then create a DataSource against
> the new DefaultContext)

Hmm, me and the admin app aren't on speaking terms after it ate my
lovingly-crafted server.xml and crapped out something simlar but invalid
back around 4.1.12...

> or, alternatively like this:
> http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg88811.html

That's great, cheers Jon!

I've seen the context.xmlin META-INF trick mentioned a few times now;
is that portable? I guess it's a 2.3 thing?


-- 
The early bird who catches the worm works for someone who comes in late
and owns the worm farm.
		-- Travis McGee
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: cross-context DataSource?

Posted by Jon Archer <jo...@perceptive.com>.
Certainly do-able. I have done so in two ways: either by putting my
datasource in under a DefaultContext (using the tomcat admin tool click
on  Tomcat Server --> Service --> Host, choose create DefaultCOntext
from dropdown list of actions on RHS, then create a DataSource against
the new DefaultContext) or, alternatively like this:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg88811.html

Regards,
Jon




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org