You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Eric Pugh <ep...@upstate.com> on 2003/11/13 14:05:02 UTC

Setting up container datasource w/ Maven

Hi all,

I have an application where I configured the javax.sql.DataSource in my
server.xml or in a /webapps/myapp.xml context file, and referenced it from
my web.xml.  Pretty standard stuff.

Now, in cactus land using the Maven plugin and tomcat4x, I can't seem to get
things to properly load.  If I wanted to use a myapp.xml context file that
had the definition of the javax.sql.DataSource, where would I place that?
Could I roll everything into web.xml?

I tried pasting the parameters into the web.xml, but no go.  It seems like I
need either the context file or server.xml.  But I don't want to muck around
with server.xml cause I think it is better to use the default server.xml
from Cactus.  So, does the myapp.xml context file go in the root tomcat
webapps dir or in where cactus is building everything to?

Thanks,
Eric

My params..

<Resource name="jdbc/portal" scope="Shareable" type="javax.sql.DataSource"
/>
  <ResourceParams name="jdbc/portal">
      <parameter>
        <name>validationQuery</name>
        <value>SELECT 1</value>
      </parameter>
      <parameter>
        <name>url</name>

<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=eFrontOffice;S
electMethod=cursor</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>somepassword</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>someuser</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>


RE: Setting up container datasource w/ Maven

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Eric,

Tomcat Context files are now supported by the <tomcat4x> nested element
of the <cactus> task. If you're using Tomcat 5.x you can even put this
context.xml file in your META-INF/ directory of your war.

Thanks
-Vincent

> -----Original Message-----
> From: Eric Pugh [mailto:epugh@upstate.com]
> Sent: 13 November 2003 15:31
> To: 'Vincent Massol'; 'Cactus Users List'
> Subject: RE: Setting up container datasource w/ Maven
> 
> Okay,  I was afraid I would have to do my own server.xml file.  Is
there
> any
> way to tell tomcat that I want it to load up with a context file?  Or
put
> all the parameters in web.xml?
> 
> Typically I structure a maven project with a /tomcat directory, which
is
> the
> tomcat I need for this app.  This tomcat is what gets deployed etc and
is
> stored in CVS.  Any special libs etc are placed in this directory.
And
> normally I have a context file like this:
> 
> <Context path="/portal" reloadable="true" docBase="..\..\src\webapp">
>   <Resource name="jdbc/efo" scope="Shareable"
> type="javax.sql.DataSource"/>
>   <Resource name="jdbc/portal" scope="Shareable"
> type="javax.sql.DataSource"
> />
> 
>  <snip of other params/>
> 
> </Context>
> 
> That file seems like I ought to be able to put it somewhere so that
when
> tomcat starts up it picks up this file.  Just not sure where.  I guess
I
> would also need to rename the path to "/portal-cactus".  The reason I
> don't
> want to muck with server.xml is when I use the custom server.xml, my
war
> file doesn't unwar..
> 
> Eric
> 
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@pivolis.com]
> > Sent: Thursday, November 13, 2003 3:16 PM
> > To: 'Cactus Users List'
> > Cc: epugh@upstate.com
> > Subject: RE: Setting up container datasource w/ Maven
> >
> >
> > Hi Eric,
> >
> > ATM, the only parameter that the cactus/ant integration exposes is
the
> > port on which the container will run. If you need to change any
other
> > parameter, you'll need to provide your own config files.
> >
> > For tomcat, that means defining the cactus.tomcat4x.config
> > property and
> > passing it your config file. For example:
> >
> > cactus.tomcat4x.config = conf/myserver.xml
> >
> > -Vincent
> >
> > > -----Original Message-----
> > > From: Eric Pugh [mailto:epugh@upstate.com]
> > > Sent: 13 November 2003 14:05
> > > To: cactus-user@jakarta.apache.org
> > > Subject: Setting up container datasource w/ Maven
> > >
> > > Hi all,
> > >
> > > I have an application where I configured the javax.sql.DataSource
in
> > my
> > > server.xml or in a /webapps/myapp.xml context file, and
> > referenced it
> > from
> > > my web.xml.  Pretty standard stuff.
> > >
> > > Now, in cactus land using the Maven plugin and tomcat4x, I
> > can't seem
> > to
> > > get
> > > things to properly load.  If I wanted to use a myapp.xml
> > context file
> > that
> > > had the definition of the javax.sql.DataSource, where would I
place
> > that?
> > > Could I roll everything into web.xml?
> > >
> > > I tried pasting the parameters into the web.xml, but no go.
> >  It seems
> > like
> > > I
> > > need either the context file or server.xml.  But I don't
> > want to muck
> > > around
> > > with server.xml cause I think it is better to use the default
> > server.xml
> > > from Cactus.  So, does the myapp.xml context file go in the root
> > tomcat
> > > webapps dir or in where cactus is building everything to?
> > >
> > > Thanks,
> > > Eric
> > >
> > > My params..
> > >
> > > <Resource name="jdbc/portal" scope="Shareable"
> > type="javax.sql.DataSource"
> > > />
> > >   <ResourceParams name="jdbc/portal">
> > >       <parameter>
> > >         <name>validationQuery</name>
> > >         <value>SELECT 1</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>url</name>
> > >
> > >
> > <value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=
> > eFrontOffi
> > ce
> > > ;S
> > > electMethod=cursor</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>password</name>
> > >         <value>somepassword</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>maxActive</name>
> > >         <value>4</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>maxWait</name>
> > >         <value>5000</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>driverClassName</name>
> > >
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>username</name>
> > >         <value>someuser</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>maxIdle</name>
> > >         <value>2</value>
> > >       </parameter>
> > >     </ResourceParams>
> > >
> > >
> > >
> >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
cactus-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



RE: Setting up container datasource w/ Maven

Posted by Eric Pugh <ep...@upstate.com>.
Okay,  I was afraid I would have to do my own server.xml file.  Is there any
way to tell tomcat that I want it to load up with a context file?  Or put
all the parameters in web.xml?

Typically I structure a maven project with a /tomcat directory, which is the
tomcat I need for this app.  This tomcat is what gets deployed etc and is
stored in CVS.  Any special libs etc are placed in this directory.  And
normally I have a context file like this:

<Context path="/portal" reloadable="true" docBase="..\..\src\webapp">
  <Resource name="jdbc/efo" scope="Shareable" type="javax.sql.DataSource"/>
  <Resource name="jdbc/portal" scope="Shareable" type="javax.sql.DataSource"
/>

 <snip of other params/>

</Context>

That file seems like I ought to be able to put it somewhere so that when
tomcat starts up it picks up this file.  Just not sure where.  I guess I
would also need to rename the path to "/portal-cactus".  The reason I don't
want to muck with server.xml is when I use the custom server.xml, my war
file doesn't unwar..

Eric

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@pivolis.com]
> Sent: Thursday, November 13, 2003 3:16 PM
> To: 'Cactus Users List'
> Cc: epugh@upstate.com
> Subject: RE: Setting up container datasource w/ Maven
>
>
> Hi Eric,
>
> ATM, the only parameter that the cactus/ant integration exposes is the
> port on which the container will run. If you need to change any other
> parameter, you'll need to provide your own config files.
>
> For tomcat, that means defining the cactus.tomcat4x.config
> property and
> passing it your config file. For example:
>
> cactus.tomcat4x.config = conf/myserver.xml
>
> -Vincent
>
> > -----Original Message-----
> > From: Eric Pugh [mailto:epugh@upstate.com]
> > Sent: 13 November 2003 14:05
> > To: cactus-user@jakarta.apache.org
> > Subject: Setting up container datasource w/ Maven
> >
> > Hi all,
> >
> > I have an application where I configured the javax.sql.DataSource in
> my
> > server.xml or in a /webapps/myapp.xml context file, and
> referenced it
> from
> > my web.xml.  Pretty standard stuff.
> >
> > Now, in cactus land using the Maven plugin and tomcat4x, I
> can't seem
> to
> > get
> > things to properly load.  If I wanted to use a myapp.xml
> context file
> that
> > had the definition of the javax.sql.DataSource, where would I place
> that?
> > Could I roll everything into web.xml?
> >
> > I tried pasting the parameters into the web.xml, but no go.
>  It seems
> like
> > I
> > need either the context file or server.xml.  But I don't
> want to muck
> > around
> > with server.xml cause I think it is better to use the default
> server.xml
> > from Cactus.  So, does the myapp.xml context file go in the root
> tomcat
> > webapps dir or in where cactus is building everything to?
> >
> > Thanks,
> > Eric
> >
> > My params..
> >
> > <Resource name="jdbc/portal" scope="Shareable"
> type="javax.sql.DataSource"
> > />
> >   <ResourceParams name="jdbc/portal">
> >       <parameter>
> >         <name>validationQuery</name>
> >         <value>SELECT 1</value>
> >       </parameter>
> >       <parameter>
> >         <name>url</name>
> >
> >
> <value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=
> eFrontOffi
> ce
> > ;S
> > electMethod=cursor</value>
> >       </parameter>
> >       <parameter>
> >         <name>password</name>
> >         <value>somepassword</value>
> >       </parameter>
> >       <parameter>
> >         <name>maxActive</name>
> >         <value>4</value>
> >       </parameter>
> >       <parameter>
> >         <name>maxWait</name>
> >         <value>5000</value>
> >       </parameter>
> >       <parameter>
> >         <name>driverClassName</name>
> >         <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
> >       </parameter>
> >       <parameter>
> >         <name>username</name>
> >         <value>someuser</value>
> >       </parameter>
> >       <parameter>
> >         <name>maxIdle</name>
> >         <value>2</value>
> >       </parameter>
> >     </ResourceParams>
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>


RE: Setting up container datasource w/ Maven

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Eric,

ATM, the only parameter that the cactus/ant integration exposes is the
port on which the container will run. If you need to change any other
parameter, you'll need to provide your own config files. 

For tomcat, that means defining the cactus.tomcat4x.config property and
passing it your config file. For example:

cactus.tomcat4x.config = conf/myserver.xml

-Vincent

> -----Original Message-----
> From: Eric Pugh [mailto:epugh@upstate.com]
> Sent: 13 November 2003 14:05
> To: cactus-user@jakarta.apache.org
> Subject: Setting up container datasource w/ Maven
> 
> Hi all,
> 
> I have an application where I configured the javax.sql.DataSource in
my
> server.xml or in a /webapps/myapp.xml context file, and referenced it
from
> my web.xml.  Pretty standard stuff.
> 
> Now, in cactus land using the Maven plugin and tomcat4x, I can't seem
to
> get
> things to properly load.  If I wanted to use a myapp.xml context file
that
> had the definition of the javax.sql.DataSource, where would I place
that?
> Could I roll everything into web.xml?
> 
> I tried pasting the parameters into the web.xml, but no go.  It seems
like
> I
> need either the context file or server.xml.  But I don't want to muck
> around
> with server.xml cause I think it is better to use the default
server.xml
> from Cactus.  So, does the myapp.xml context file go in the root
tomcat
> webapps dir or in where cactus is building everything to?
> 
> Thanks,
> Eric
> 
> My params..
> 
> <Resource name="jdbc/portal" scope="Shareable"
type="javax.sql.DataSource"
> />
>   <ResourceParams name="jdbc/portal">
>       <parameter>
>         <name>validationQuery</name>
>         <value>SELECT 1</value>
>       </parameter>
>       <parameter>
>         <name>url</name>
> 
>
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=eFrontOffi
ce
> ;S
> electMethod=cursor</value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>somepassword</value>
>       </parameter>
>       <parameter>
>         <name>maxActive</name>
>         <value>4</value>
>       </parameter>
>       <parameter>
>         <name>maxWait</name>
>         <value>5000</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>         <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
>       </parameter>
>       <parameter>
>         <name>username</name>
>         <value>someuser</value>
>       </parameter>
>       <parameter>
>         <name>maxIdle</name>
>         <value>2</value>
>       </parameter>
>     </ResourceParams>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org