Cannot load JDBC driver class 'com.mysql.jdbc.Driver' problem

I am trying to develop JSF - MySQL application with MyEclipse.

web-inf/web.xml

...

<resource-ref>

<res-ref-name>jdbc/mmsDB</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

meta-inf/context.xml

<Context

docBase="${catalina.home}/webapps/ch2"

path="/Grid"

reloadable="true">

<Resource name="jdbc/mmsDB" auth="Container" type="javax.sql.DataSource"

maxActive="100" maxIdle="30" maxWait="10000"

username="root" password="root"

driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://localhost:3306/example"/>

</Context>

Java code to access database:

Context ctx =new InitialContext();

if (ctx ==null)thrownew NamingException("No initial context");

DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/mmsDB");

if (ds ==null)thrownew NamingException("No data source");

Connection conn = ds.getConnection();

When deploying application I always get error message

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driverclass'com.mysql.jdbc.Driver'

The problem is solved when I copy "mysql-connector-java-5.1.0-bin.jar" in Tomcat 5.5\common\lib folder, but I need to develop application whitout adding anything to the Tomcat instalation.

I have added "mysql-connector-java-5.1.0-bin.jar" as an external library to the Java build path.

Any suggestion would be helpful.

[2357 byte] By [Zorana] at [2007-11-27 4:54:31]
# 1

> ...but I need to develop

> application whitout adding anything to the Tomcat

> instalation.

That statement is ridiculous. To do anything in tomcat you have to add something to it.

There is a standard place within application area for adding jars. I believe that is the normal practice for adding it. If you search here you can find suggestions for how to add it.

jschella at 2007-7-12 10:09:13 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

> ...but I need to develop

> application whitout adding anything to the Tomcat

> instalation.

Sorry, I've meant anything but war file.

>There is a standard place within application area for adding jars. I

>believe that is the normal practice for adding it. If you search here you

>can find suggestions for how to add it.

Yes, there is a WebRoot/WEB-INF/lib folder where all jars are placed. I've tried to put it there, and setup Java build path but still didn't work.

Zorana at 2007-7-12 10:09:13 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Datasources are to be created on the application server. Then the AS also needs the desired driver. It can't get it out of the WAR automagically, you *have* to put it in the /lib directory.
BalusCa at 2007-7-12 10:09:13 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...