tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Bowen <kbo...@als.com>
Subject Tomcat 5.5.26 / 6.0.18 difference: loading jdbc jar??
Date Thu, 27 Nov 2008 00:21:33 GMT
Hi all,

Using: tomcat-6.0.18 (download from Apache), simply unzipped & running
        java 1.5.0_16 on a Mac OS X 10.5.5
        mysql-connector-java-3.1.14-bin

I've just switched up from 5.5.26 to 6.0.18 (both downloads from  
Apache).
I seem to have one datasource difference: Using the same  
configurations and code:

    Under 5.5.26, TC+myApp will load the mysql jar from either common/ 
lib or webapps/myApp/WEB-INF/lib.

    Under 6.0.18, TC+myApp will only load the mysql jar from tomcat's  
lib.  If I try to move the mysql
    jar from Tomcat's lib to webapps/myApp/WEB-INF/lib, I get the  
following error when the first attempt
    to access the db is made:
         Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

I scanned the Tomcat 6 changelog, but nothing about this caught my eye  
-- but my eyes are not that good anymore :-).
So:

A) is this a new feature in TC6? (if so is there doc anywhere?);
or (more likely)
B) is there something I need to adjust in my configuration and jndi  
code?
In case of the latter, I've attached my context.xml (from myApp/META- 
INF) and my jndi code at the end.

Have a Happy Thanksgiving (wherever it is celebrated)
Thanks much in advance,
Ken Bowen

context.xml:
<Context path="" debug="5" reloadable="true" crossContext="true">

   <Resource name="jdbc/securities_info" auth="Container"  
type="javax.sql.DataSource"
             maxActive="100" maxIdle="30" maxWait="10000"
             username="XXX" password="XXX"
             driverClassName="com.mysql.jdbc.Driver"
             url="jdbc:mysql://sequoyah:3306/securities_info"
             validationQuery="select 1"
   />

</Context>

Datasource setup (runs in contextInitialized in ServletContextListener):

         Context initialContext = new InitialContext();
         if (initialContext == null ) {
                 throw new Exception("Boom - No Initial Context");
         }
         Context envCtx = (Context) initialContext.lookup("java:comp/ 
env");

         String key = "jdbc" + "/" + SECURITIES_INFO;
         DataSource ds = (DataSource)envCtx.lookup(key);
         if (ds != null ){
             SI_DAOBase.setDataSource(ds);
             MD_DAOs2.set_siDAOBase(new SI_DAOBase());
         }
...


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


Mime
View raw message