You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ken Bowen <kb...@als.com> on 2007/09/16 16:26:24 UTC

Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Hello,

I'm working on a CENTOS 5 Linux setup.
I'm trying to avoid the pre-loaded tomcat which was installed in 
/usr/share/tomcat5.
I downloaded (from apache) and installed tomcat5.5.25 and installed it 
in /opt/tomcat5.
I made sure the existing tomcat is not running and I renamed 
/usr/share/tomcat5.

I start it (the new tomcat) with /opt/tomcat5/bin/startup.sh and it runs 
fine:
Tomcat manager runs and I can start/stop the built-in apps.

I have an app which I developed using tomcat5.5.9 on Windows, and I am 
trying to
transfer it to this Linux setting.

I placed my exploded app in webapps.  The app wants to use a Mysql 
database named sb_data.
The same database as on Windows has been replicated in Mysql in the 
Linux setup.
I have the following context.xml in my META-INF folder:

    <Context path="/myapp" docBase="myapp"
                      debug="5" reloadable="true" crossContext="true">
       <Resource name="jdbc/sb_data" auth="Container"
    type="javax.sql.DataSource"
                 maxActive="100" maxIdle="30" maxWait="10000"
                 username="sb_normal" password="********"
                 driverClassName="com.mysql.jdbc.Driver"
                
    url="jdbc:mysql://localhost:3306/sb_data?autoReconnect=true"/>
    </Context>

My application has a registered AppListener in which I establish the 
DataSource
in the contextInitialized method and use it to do some initial work with 
the database:

        System.out.println("MyApp AppListener: ENTER");
        ....
        Context envCtx = (Context) initialContext.lookup("java:comp/env");

        String key = "jdbc" + "/" + "sb_data";
        DataSource ds = (DataSource)envCtx.lookup(key);
        if (ds != null ){
            DAOBaseData.setDataSource(ds);
        }
        ....
        ...CALL to DAOBaseData.getConnection();  HERE
        ....
        System.out.println("MyApp AppListener: EXIT");

The code for getConnection() looks like this:

        public Connection getConnection() throws DAOException
        {
            Connection connection = null;
            if (datasource!= null) {
                try {
                    connection = datasource.getConnection();
                } catch (SQLException e) {
                      //TODO: Log this
                      String message = e.getMessage();
                      System.out.println("DAOBaseData: "+message);
                      throw new DAOException(message);
                }
            }
            connCount++;
            System.out.println("Connection[data] allocated: #="+connCount);
            return connection;
        }

This works ok on Windows, but in the Linux setting I get the following 
error in
the catalina.out log:

        MyApp AppListener: ENTER
        DAOBaseData: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
        com.myapp Error: Cannot load JDBC driver class
    'com.mysql.jdbc.Driver'
        MyApp AppListener: EXIT

I'm using the mysql-connector-java-3.1.14-bin.jar and it is present in 
WEB-INF/lib.
I tried copying it to /opt/tomcat5/common/lib , but I still get the same 
error.

I'm confused.  Why does tomcat on Windows find the JDBC driver, but not 
find it on Linux?

Thanks in advance,
Ken Bowen


---------------------------------------------------------------------
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


Re: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by David Smith <dn...@cornell.edu>.
Tomcat's database pooling implements a slightly refactored version of 
the Commons DBCP project -- packages were renamed to avoid conflicts 
should a developer decide to use the Commons DBCP library in their own 
app.  You can find a complete list of possible attributes for the 
Resource definition here:

http://commons.apache.org/dbcp/api-1.2.2/org/apache/commons/dbcp/BasicDataSource.html

Just look at the setters -- remove the word set from the beginning of 
the method name and drop the case on the first letter after 'set'.  For 
example, if you want access setValidationQuery(), you would drop set and 
lower case the V for validationQuery="" in your <Resource ../> definition.

--David

Ken Bowen wrote:
> David,
>
> Bingo!  Right on:  Changed all permissions (chown -R tomcat myapp), 
> and dropped the mysql jar from WEB-INF/lib, and
> it all works.  Many thanks!  I do hate it when I forget simple stuff 
> like permissions.  Moving things from Windows to *nix
> always does that to me.
> Side note question:  Am I correct that the following is the intended 
> xml?:
>
> <Resource name="jdbc/sb_data" auth="Container"
>               type="javax.sql.DataSource"
>                maxActive="100" maxIdle="30" maxWait="10000"
>                validationQuery="select 1"
>                username="sb_normal" password="********"
>                driverClassName="com.mysql.jdbc.Driver"
>                 url="jdbc:mysql://localhost:3306/sb_data"/>
>
> Where could I read more about these kinds of details?
>
> Thanks again,
> Ken Bowen
>
> David Smith wrote:
>> Don't 'copy' the mysql driver from WEB-INF/lib to 
>> TOMCAT_HOME/common/lib -- move it.  It cannot be in both places at 
>> once.  Also be sure the permissions are set correctly so tomcat can 
>> read the jar and be sure you've restarted tomcat after the move so 
>> the classloaders pick it up properly.  I have no idea why it works in 
>> Windows at all unless the Windows install has a copy of it in 
>> common/lib already -- which can cause problems later on if it's also 
>> in WEB-INF/lib.
>>
>> As a side note (and this is becoming a mantra with me) please don't 
>> use ?autoReconnect=true in your jdbc url.  Instead add the attribute 
>> validationQuery="select 1" in the Resource element.  That tells the 
>> pool how to validate the connection and optionally regenerate it 
>> before you borrow.
>>
>> --David
>>
>> Ken Bowen wrote:
>>> Hello,
>>>
>>> I'm working on a CENTOS 5 Linux setup.
>>> I'm trying to avoid the pre-loaded tomcat which was installed in 
>>> /usr/share/tomcat5.
>>> I downloaded (from apache) and installed tomcat5.5.25 and installed 
>>> it in /opt/tomcat5.
>>> I made sure the existing tomcat is not running and I renamed 
>>> /usr/share/tomcat5.
>>>
>>> I start it (the new tomcat) with /opt/tomcat5/bin/startup.sh and it 
>>> runs fine:
>>> Tomcat manager runs and I can start/stop the built-in apps.
>>>
>>> I have an app which I developed using tomcat5.5.9 on Windows, and I 
>>> am trying to
>>> transfer it to this Linux setting.
>>>
>>> I placed my exploded app in webapps.  The app wants to use a Mysql 
>>> database named sb_data.
>>> The same database as on Windows has been replicated in Mysql in the 
>>> Linux setup.
>>> I have the following context.xml in my META-INF folder:
>>>
>>>    <Context path="/myapp" docBase="myapp"
>>>                      debug="5" reloadable="true" crossContext="true">
>>>       <Resource name="jdbc/sb_data" auth="Container"
>>>    type="javax.sql.DataSource"
>>>                 maxActive="100" maxIdle="30" maxWait="10000"
>>>                 username="sb_normal" password="********"
>>>                 driverClassName="com.mysql.jdbc.Driver"
>>>                   
>>> url="jdbc:mysql://localhost:3306/sb_data?autoReconnect=true"/>
>>>    </Context>
>>>
>>> My application has a registered AppListener in which I establish the 
>>> DataSource
>>> in the contextInitialized method and use it to do some initial work 
>>> with the database:
>>>
>>>        System.out.println("MyApp AppListener: ENTER");
>>>        ....
>>>        Context envCtx = (Context) 
>>> initialContext.lookup("java:comp/env");
>>>
>>>        String key = "jdbc" + "/" + "sb_data";
>>>        DataSource ds = (DataSource)envCtx.lookup(key);
>>>        if (ds != null ){
>>>            DAOBaseData.setDataSource(ds);
>>>        }
>>>        ....
>>>        ...CALL to DAOBaseData.getConnection();  HERE
>>>        ....
>>>        System.out.println("MyApp AppListener: EXIT");
>>>
>>> The code for getConnection() looks like this:
>>>
>>>        public Connection getConnection() throws DAOException
>>>        {
>>>            Connection connection = null;
>>>            if (datasource!= null) {
>>>                try {
>>>                    connection = datasource.getConnection();
>>>                } catch (SQLException e) {
>>>                      //TODO: Log this
>>>                      String message = e.getMessage();
>>>                      System.out.println("DAOBaseData: "+message);
>>>                      throw new DAOException(message);
>>>                }
>>>            }
>>>            connCount++;
>>>            System.out.println("Connection[data] allocated: 
>>> #="+connCount);
>>>            return connection;
>>>        }
>>>
>>> This works ok on Windows, but in the Linux setting I get the 
>>> following error in
>>> the catalina.out log:
>>>
>>>        MyApp AppListener: ENTER
>>>        DAOBaseData: Cannot load JDBC driver class 
>>> 'com.mysql.jdbc.Driver'
>>>        com.myapp Error: Cannot load JDBC driver class
>>>    'com.mysql.jdbc.Driver'
>>>        MyApp AppListener: EXIT
>>>
>>> I'm using the mysql-connector-java-3.1.14-bin.jar and it is present 
>>> in WEB-INF/lib.
>>> I tried copying it to /opt/tomcat5/common/lib , but I still get the 
>>> same error.
>>>
>>> I'm confused.  Why does tomcat on Windows find the JDBC driver, but 
>>> not find it on Linux?
>>>
>>> Thanks in advance,
>>> Ken Bowen
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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


RE: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ken Bowen [mailto:kbowen@als.com] 
> Subject: Re: Datasource: Cannot load JDBC driver class 
> 'com.mysql.jdbc.Driver'
> 
> <Resource name="jdbc/sb_data" auth="Container"
>                type="javax.sql.DataSource"
>                 maxActive="100" maxIdle="30" maxWait="10000"
>                 validationQuery="select 1"
>                 username="sb_normal" password="********"
>                 driverClassName="com.mysql.jdbc.Driver"
>                  url="jdbc:mysql://localhost:3306/sb_data"/>
> Where could I read more about these kinds of details?

You've probably already been here:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h
tml

Generally, the attributes of a <Resource> element correspond to elements
nested within a <resource-ref> element as described in the servlet spec.
Most of the attributes will be unique to the resource type, so the
Tomcat doc can't provide a great deal of specifics here.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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


Re: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by Ken Bowen <kb...@als.com>.
David,

Bingo!  Right on:  Changed all permissions (chown -R tomcat myapp), and 
dropped the mysql jar from WEB-INF/lib, and
it all works.  Many thanks!  I do hate it when I forget simple stuff 
like permissions.  Moving things from Windows to *nix
always does that to me.
 Side note question:  Am I correct that the following is the intended xml?:

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

Where could I read more about these kinds of details?

Thanks again,
Ken Bowen

David Smith wrote:
> Don't 'copy' the mysql driver from WEB-INF/lib to 
> TOMCAT_HOME/common/lib -- move it.  It cannot be in both places at 
> once.  Also be sure the permissions are set correctly so tomcat can 
> read the jar and be sure you've restarted tomcat after the move so the 
> classloaders pick it up properly.  I have no idea why it works in 
> Windows at all unless the Windows install has a copy of it in 
> common/lib already -- which can cause problems later on if it's also 
> in WEB-INF/lib.
>
> As a side note (and this is becoming a mantra with me) please don't 
> use ?autoReconnect=true in your jdbc url.  Instead add the attribute 
> validationQuery="select 1" in the Resource element.  That tells the 
> pool how to validate the connection and optionally regenerate it 
> before you borrow.
>
> --David
>
> Ken Bowen wrote:
>> Hello,
>>
>> I'm working on a CENTOS 5 Linux setup.
>> I'm trying to avoid the pre-loaded tomcat which was installed in 
>> /usr/share/tomcat5.
>> I downloaded (from apache) and installed tomcat5.5.25 and installed 
>> it in /opt/tomcat5.
>> I made sure the existing tomcat is not running and I renamed 
>> /usr/share/tomcat5.
>>
>> I start it (the new tomcat) with /opt/tomcat5/bin/startup.sh and it 
>> runs fine:
>> Tomcat manager runs and I can start/stop the built-in apps.
>>
>> I have an app which I developed using tomcat5.5.9 on Windows, and I 
>> am trying to
>> transfer it to this Linux setting.
>>
>> I placed my exploded app in webapps.  The app wants to use a Mysql 
>> database named sb_data.
>> The same database as on Windows has been replicated in Mysql in the 
>> Linux setup.
>> I have the following context.xml in my META-INF folder:
>>
>>    <Context path="/myapp" docBase="myapp"
>>                      debug="5" reloadable="true" crossContext="true">
>>       <Resource name="jdbc/sb_data" auth="Container"
>>    type="javax.sql.DataSource"
>>                 maxActive="100" maxIdle="30" maxWait="10000"
>>                 username="sb_normal" password="********"
>>                 driverClassName="com.mysql.jdbc.Driver"
>>                   
>> url="jdbc:mysql://localhost:3306/sb_data?autoReconnect=true"/>
>>    </Context>
>>
>> My application has a registered AppListener in which I establish the 
>> DataSource
>> in the contextInitialized method and use it to do some initial work 
>> with the database:
>>
>>        System.out.println("MyApp AppListener: ENTER");
>>        ....
>>        Context envCtx = (Context) 
>> initialContext.lookup("java:comp/env");
>>
>>        String key = "jdbc" + "/" + "sb_data";
>>        DataSource ds = (DataSource)envCtx.lookup(key);
>>        if (ds != null ){
>>            DAOBaseData.setDataSource(ds);
>>        }
>>        ....
>>        ...CALL to DAOBaseData.getConnection();  HERE
>>        ....
>>        System.out.println("MyApp AppListener: EXIT");
>>
>> The code for getConnection() looks like this:
>>
>>        public Connection getConnection() throws DAOException
>>        {
>>            Connection connection = null;
>>            if (datasource!= null) {
>>                try {
>>                    connection = datasource.getConnection();
>>                } catch (SQLException e) {
>>                      //TODO: Log this
>>                      String message = e.getMessage();
>>                      System.out.println("DAOBaseData: "+message);
>>                      throw new DAOException(message);
>>                }
>>            }
>>            connCount++;
>>            System.out.println("Connection[data] allocated: 
>> #="+connCount);
>>            return connection;
>>        }
>>
>> This works ok on Windows, but in the Linux setting I get the 
>> following error in
>> the catalina.out log:
>>
>>        MyApp AppListener: ENTER
>>        DAOBaseData: Cannot load JDBC driver class 
>> 'com.mysql.jdbc.Driver'
>>        com.myapp Error: Cannot load JDBC driver class
>>    'com.mysql.jdbc.Driver'
>>        MyApp AppListener: EXIT
>>
>> I'm using the mysql-connector-java-3.1.14-bin.jar and it is present 
>> in WEB-INF/lib.
>> I tried copying it to /opt/tomcat5/common/lib , but I still get the 
>> same error.
>>
>> I'm confused.  Why does tomcat on Windows find the JDBC driver, but 
>> not find it on Linux?
>>
>> Thanks in advance,
>> Ken Bowen
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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
>
>


---------------------------------------------------------------------
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


Re: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by David Smith <dn...@cornell.edu>.
Don't 'copy' the mysql driver from WEB-INF/lib to TOMCAT_HOME/common/lib 
-- move it.  It cannot be in both places at once.  Also be sure the 
permissions are set correctly so tomcat can read the jar and be sure 
you've restarted tomcat after the move so the classloaders pick it up 
properly.  I have no idea why it works in Windows at all unless the 
Windows install has a copy of it in common/lib already -- which can 
cause problems later on if it's also in WEB-INF/lib.

As a side note (and this is becoming a mantra with me) please don't use 
?autoReconnect=true in your jdbc url.  Instead add the attribute 
validationQuery="select 1" in the Resource element.  That tells the pool 
how to validate the connection and optionally regenerate it before you 
borrow.

--David

Ken Bowen wrote:
> Hello,
>
> I'm working on a CENTOS 5 Linux setup.
> I'm trying to avoid the pre-loaded tomcat which was installed in 
> /usr/share/tomcat5.
> I downloaded (from apache) and installed tomcat5.5.25 and installed it 
> in /opt/tomcat5.
> I made sure the existing tomcat is not running and I renamed 
> /usr/share/tomcat5.
>
> I start it (the new tomcat) with /opt/tomcat5/bin/startup.sh and it 
> runs fine:
> Tomcat manager runs and I can start/stop the built-in apps.
>
> I have an app which I developed using tomcat5.5.9 on Windows, and I am 
> trying to
> transfer it to this Linux setting.
>
> I placed my exploded app in webapps.  The app wants to use a Mysql 
> database named sb_data.
> The same database as on Windows has been replicated in Mysql in the 
> Linux setup.
> I have the following context.xml in my META-INF folder:
>
>    <Context path="/myapp" docBase="myapp"
>                      debug="5" reloadable="true" crossContext="true">
>       <Resource name="jdbc/sb_data" auth="Container"
>    type="javax.sql.DataSource"
>                 maxActive="100" maxIdle="30" maxWait="10000"
>                 username="sb_normal" password="********"
>                 driverClassName="com.mysql.jdbc.Driver"
>                   
> url="jdbc:mysql://localhost:3306/sb_data?autoReconnect=true"/>
>    </Context>
>
> My application has a registered AppListener in which I establish the 
> DataSource
> in the contextInitialized method and use it to do some initial work 
> with the database:
>
>        System.out.println("MyApp AppListener: ENTER");
>        ....
>        Context envCtx = (Context) initialContext.lookup("java:comp/env");
>
>        String key = "jdbc" + "/" + "sb_data";
>        DataSource ds = (DataSource)envCtx.lookup(key);
>        if (ds != null ){
>            DAOBaseData.setDataSource(ds);
>        }
>        ....
>        ...CALL to DAOBaseData.getConnection();  HERE
>        ....
>        System.out.println("MyApp AppListener: EXIT");
>
> The code for getConnection() looks like this:
>
>        public Connection getConnection() throws DAOException
>        {
>            Connection connection = null;
>            if (datasource!= null) {
>                try {
>                    connection = datasource.getConnection();
>                } catch (SQLException e) {
>                      //TODO: Log this
>                      String message = e.getMessage();
>                      System.out.println("DAOBaseData: "+message);
>                      throw new DAOException(message);
>                }
>            }
>            connCount++;
>            System.out.println("Connection[data] allocated: 
> #="+connCount);
>            return connection;
>        }
>
> This works ok on Windows, but in the Linux setting I get the following 
> error in
> the catalina.out log:
>
>        MyApp AppListener: ENTER
>        DAOBaseData: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
>        com.myapp Error: Cannot load JDBC driver class
>    'com.mysql.jdbc.Driver'
>        MyApp AppListener: EXIT
>
> I'm using the mysql-connector-java-3.1.14-bin.jar and it is present in 
> WEB-INF/lib.
> I tried copying it to /opt/tomcat5/common/lib , but I still get the 
> same error.
>
> I'm confused.  Why does tomcat on Windows find the JDBC driver, but 
> not find it on Linux?
>
> Thanks in advance,
> Ken Bowen
>
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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


RE: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ken Bowen [mailto:kbowen@als.com] 
> Subject: Re: Datasource: Cannot load JDBC driver class 
> 'com.mysql.jdbc.Driver'
>
> BUT:  It is running and yet my META-INF/context.xml
> still contains the path and docBase attributes. 

In your case, they are probably being ignored, but no one can guarantee
just what the behavior will be in all versions of Tomcat when illegal
attributes are present.

> Where can I read up on what should be in META-INF/context.xml ??

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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


Re: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by Ken Bowen <kb...@als.com>.
Chuck,

Thanks.  As Dave pointed out, my core difficulty was a permissions problem.
BUT:  It is running and yet my

META-INF/context.xml

still contains the path and docBase attributes. 
Where can I read up on what should be in META-INF/context.xml ??

RE:

By intercepting and discarding the original exception, you threw away
much useful information, such as the stack trace.  Don't do that.

Of course, you're right.  It's only the presence of my  "//TODO: log 
this; kill off everything..."
that enables me to claim that I have the right stuff on my list of TODOs.

Thanks again,
Ken Bowen

Caldarale, Charles R wrote:
>> From: Ken Bowen [mailto:kbowen@als.com] 
>> Subject: Datasource: Cannot load JDBC driver class 
>> 'com.mysql.jdbc.Driver'
>>
>>     <Context path="/myapp" docBase="myapp"
>>     
>
> Take out the path and docBase attributes - they're not allowed when
> using META-INF/context.xml.  (This is not likely to solve your problem,
> but let's clean up the obvious things first.)
>
>   
>>         MyApp AppListener: ENTER
>>         DAOBaseData: Cannot load JDBC driver class 
>> 'com.mysql.jdbc.Driver'
>>     
>
> By intercepting and discarding the original exception, you threw away
> much useful information, such as the stack trace.  Don't do that.
>
>   
>> I tried copying it to /opt/tomcat5/common/lib , but I still 
>> get the same error.
>>     
>
> The same jar must not be present in more than one node in a given
> classloader branch.  So it would be o.k. to /move/ the jar to
> common/lib, but you must not have it in both common/lib and WEB-INF/lib.
>
>   
>> Why does tomcat on Windows find the JDBC 
>> driver, but not find it on Linux?
>>     
>
> Don't know, but the fix the above stuff first (along with what David S
> suggested), and let's go from there.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> 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
>
>
>   


---------------------------------------------------------------------
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


RE: Datasource: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ken Bowen [mailto:kbowen@als.com] 
> Subject: Datasource: Cannot load JDBC driver class 
> 'com.mysql.jdbc.Driver'
> 
>     <Context path="/myapp" docBase="myapp"

Take out the path and docBase attributes - they're not allowed when
using META-INF/context.xml.  (This is not likely to solve your problem,
but let's clean up the obvious things first.)

>         MyApp AppListener: ENTER
>         DAOBaseData: Cannot load JDBC driver class 
> 'com.mysql.jdbc.Driver'

By intercepting and discarding the original exception, you threw away
much useful information, such as the stack trace.  Don't do that.

> I tried copying it to /opt/tomcat5/common/lib , but I still 
> get the same error.

The same jar must not be present in more than one node in a given
classloader branch.  So it would be o.k. to /move/ the jar to
common/lib, but you must not have it in both common/lib and WEB-INF/lib.

> Why does tomcat on Windows find the JDBC 
> driver, but not find it on Linux?

Don't know, but the fix the above stuff first (along with what David S
suggested), and let's go from there.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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