> You are not supposed to edit server.xml in order to
> make your pooled connections work. 

You do when its a connection pool shared by more than
one application. How else do you create global
resources?

Anyway, all solved now. Looks like there was a
context.xml from a previous build in the
/conf/Catalina directory that wasn't deleted and it
wasn't correct.


> messages suggest, I would you recomend you put your
> context.xml file inside a META-INF directory, as you
> mentioned. As a matter of an example, here is my
> context.xml file, which is stored inside my app
> META-INF directory and works fine (I'm using SQL
> server 2005):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Context>
> 
>       <Resource 
>               name="jdbc/YourJdbcName" 
>               auth="Container"
>               type="javax.sql.DataSource" 
>               username="user"
>               password="pass" 
>               driverClassName="net.sourceforge.jtds.jdbc.Driver"
>       
>
url="jdbc:jtds:sqlserver://127.0.0.1:1433/YourDataBase;appName=Your
> App;socketTimeout=180;loginTimeout=10;" 
>               maxActive="30" 
>               maxIdle="2" 
>               maxWait="60"
>               removeAbandoned="true"
>               maxStatements="2147483647"
>               removeAbandonedTimeout="200"
>               validationQuery=" SELECT 1 "
>               LogAbandoned="true"
>               />
> </Context>
> 
> Besides that, check whether your driver jar files
> are placed inside catalina_home/lib directory. Along
> with these files, you would also need
> commons-collections-3.2.jar, commons-dbutils-1.1.jar
> and commons-pool-1.3.jar inside that dir too,
> otherwise your pools won't work. The versions
> mentioned in the files are the latest ones, but I
> guess you can use the ones you have.
> 
> If it still doesn't work, tell us...
> 
> Yours,
> 
> Marcus Milanez
> 
> -----Mensagem original-----
> De: Charl Gerber [mailto:[EMAIL PROTECTED] 
> Enviada em: quinta-feira, 27 de março de 2008 04:04
> Para: Tomcat Users List
> Assunto: Re: Application context configuration &
> datasources
> 
> server.xml:
> 
> <GlobalNamingResources>
> 
>     <Resource name="jdbc/mydatasource" 
>               auth="Container" 
>               type="javax.sql.DataSource" 
>               maxActive="16" 
>               maxIdle="8" 
>               maxWait="10000" 
>               username="abc" 
>               password="xyz" 
>              
> driverClassName="com.mysql.jdbc.Driver" 
>            
>
url="jdbc:mysql://localhost/mydatabase?autoReconnect=true"
> /> 
> 
>   </GlobalNamingResources>
> 
> 
> As I said, if I move the META-INF/context.xml
> contents into my server.xml, then it works fine, but
> then I cannot use ant manager tasks to redeploy.
> 
> I have also tried to put the driver jar into the
> application war. No luck.
> 
> 
> --- Sameer Acharya <[EMAIL PROTECTED]> wrote:
> 
> > Where is your Resource definition ? seems like the
> Driver class name 
> > and url is not defined.
> > 
> > -Sameer
> > 
> > --- Charl Gerber <[EMAIL PROTECTED]> wrote:
> > 
> > > I have 4 Tomcat environments for the same
> > > application:
> > > two development machines, 1 test and 1
> production.
> > > Development machines are Windows 2000 and Vista,
> > the
> > > others are linux. All 4 machines have Tomcat
> > 6.0.14
> > > installed.
> > > 
> > > I really have problems getting the application
> properly deployed and 
> > > configured. I have a global datasource
> configured in tomcat's 
> > > server.xml and
> > the
> > > mysql driver jar is in the /lib directory of
> > tomcat.
> > > 
> > > If I deploy the application by putting it in the
> webapps dir or 
> > > using the ant manager tasks, I get this
> > > exception:
> > > 
> > > Caused by:
> > > org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> > > Cannot
> > > create JDBC driver of class '' for connect URL
> 'null'
> > >   at
> > >
> >
>
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
> > >   at
> > >
> >
>
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
> > >   at
> > >
> >
>
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
> > >   at
> > >
> >
>
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
> > >   ... 45 more
> > > 
> > > If I copy the contents of the application's
> META-INF/context.xml 
> > > into the server.xml, then the application and
> datasources loads 
> > > fine, no
> > problems.
> > > It looks something like:
> > > 
> > > <Context path="/myapp" docBase="path_to_war"
> > > debug="0"
> > > reloadable="false" antiJARLocking="true"
> > > antiResourceLocking="true" crossContext="true">
> > >   <ResourceLink name="jdbc/mydatasource"
> > > global="jdbc/mydatasource"
> > > type="javax.sql.DataSource"
> > > />
> > > </Context>
> > > 
> > > (I then have a context.xml and the same part in
> > the
> > > server.xml, but it doesn't seem to do harm)
> > > 
> > > But then I cannot use the ant manager tasks to
> redeploy the 
> > > application:
> > > 
> > > C:\projects\myapp\build.xml:198: FAIL - Context
> /myapp is defined in 
> > > server.xml and may not be undeployed
> > > 
> > > On the test and production (linux) servers, its
> > not
> > > that critical, as I do not do a lot of
> > deployments.
> > > So
> > > there I have the app configured in server.xml
> and
> > a
> > > deployment basically means stopping stopping,
> unzipping the war to 
> > > an exploded docbase dir and starting tomcat
> again. (The restarting 
> > > is also required because I use hibernate and
> there are
> > some
> > > known memory leak issues there)
> > > 
> > > So can someone clarify where/how the application
> must be configured 
> > > to be able to use the ant manager tasks, but
> also to get the 
> > > datasource working?
> > > 
> > > Thanks!
> > > 
> > > Charl
> > > 
> > > 
> 
=== message truncated ===


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to