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.

