tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul" <p...@msci.ca>
Subject Re: how to use single dbcp resource across multiple webapps
Date Fri, 12 Sep 2003 19:43:01 GMT
in case anyone has any suggestions ...

in server.xml i specified jndi dbcp datasource, ie, <Resource
name="jdbc/eplResrc" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/eplResrc"> within <GlobalNamingResources>

then in each CONTEXT definitions, i added:

<ResourceLink name="jdbc/eplResrc" global="jdbc/eplResrc"
type="javax.sql.DataSource"/>

where the CONTEXT tag for ROOT is as follows: <Context path=""
docBase="ROOT" debug="0">

The result is that db access occurs successfully for non-root web app, but
NOT for root web app.  Based on the assumption that may be a problem or
added complexity in configuring this resource link with the root web app, i
am going to test connectivity for a second non-root web app.  Any other
suggestions welcome.

-paul lomack


----- Original Message ----- 
From: "Paul" <paul@msci.ca>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Friday, September 12, 2003 10:16 AM
Subject: Re: how to use single dbcp resource across multiple webapps


> i think i may have found an answer.
>
> from the archives, message subject "ResourceLink and DefaultContext", Cam
> Smith reported following:
>
> "If I place the ResourceLink inside explicity declared Context
> elements, all works fine and I can access the data source from multiple
> webapps."
>
> Cam also provides example server.xml scripts pertaining to above.
> Furthermore, Colin Madere advises same solution:
>
> "Many recent posts regarding this with problems using ResourceLinks in the
> DefaultContext, but if you're explicitly defining your contexts as it
> appears you are, it should work (link global resource in each Context you
> want to use it in)."
>
> So, i am going to try to configure this.  It is just a matter of wadding
> hip-deep in the insect and reptile infested swamps of Tomcat's xml tag
> system.
>
> -paul lomack
>
>
> ----- Original Message ----- 
> From: "Wynkoop, Robert M" <robert.m.wynkoop@citigroup.com>
> To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
> Sent: Thursday, September 11, 2003 3:41 PM
> Subject: RE: how to use single dbcp resource across multiple webapps
>
>
> > Paul,
> >
> > I just went through this exercise today.
> > (See msgs with subject = "java.sql.SQLException: Cannot load JDBC driver
> > class 'null'")
> > I do not know why it does not work when set up in the global
> context(Tomcat
> > admin puts datasources here).  Let us know if you get an answer.
> >
> > Later,
> >
> >
> > Robert Wynkoop
> >
> > -----Original Message-----
> > From: Paul [mailto:paul@msci.ca]
> > Sent: Thursday, September 11, 2003 2:04 PM
> > To: Tomcat Users List
> > Subject: how to use single dbcp resource across multiple webapps
> >
> >
> > hi,
> >
> > i setup dbcp according to Tomcat docs successfully for one web app, but
> when
> > tried to use resource (defined in server.xml) in second web app (with
> > appropriate WEB-INF/web.xml), get the following:
> >
> > java.sql.SQLException: Cannot load JDBC driver class 'null'
> >
> > meanwhile, dbcp resource works fine with first app.
> > i figure it is because the resource is defined within following context,
> > where path specifies first web app:
> >
> > <Context path="/epl" docBase="epl" debug="5" reloadable="true"
> > crossContext="true">
> >
> > do i need to define a second context and dbcp resource, or is there some
> way
> > to use a single dbcp resource across contexts/web-apps?
> >
> > -paul lomack
> >
> > ---------------------------------------------------------------------
> > 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
>
>



Mime
View raw message