MySql and Tomcat 5.5

I have read several threads, and others are having this problem but the resolutions do not seem to be posted or are different than what I am having. Hopefully someone can help me figure out...

Cannot create JDBC driver of class '' for connect URL 'null'

I verified that my url was correct here...

http://dev.mysql.com/doc/connector/j/en/cj-driver-classname.html

Here is my server.xml snippet

<GlobalNamingResources>

...

<Resource name="jdbc/mtshr" auth="Container"

type="javax.sql.DataSource" username="xxxx" password="xxxx"

driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://localhost:3306/mtshr?autoReconnect=true"

maxActive="8" maxIdle="4"/>

</GlobalNamingResources>

in my WEB-INF/web.xml

<resource-ref>

<description>

HRDB Deployment

</description>

<res-ref-name>

jdbc/mtshr

</res-ref-name>

<res-type>

javax.sql.DataSource

</res-type>

<res-auth>

Container

</res-auth>

</resource-ref>

I have tried moving the mysql-connector-java-3.1.7-bin.jar to both common/lib and WEB-INF/lib

My code to connect is...

java.sql.Connection Conn = null;

javax.sql.DataSource ds = null;

java.sql.Statement Stmt = null;

java.sql.ResultSet rs = null;

javax.naming.InitialContext ctx = new javax.naming.InitialContext();

javax.naming.Context envctx = (javax.naming.Context) ctx.lookup("java:comp/env");

ds = (javax.sql.DataSource) envctx.lookup("jdbc/mtshr");

Conn = ds.getConnection();

Stmt = Conn.createStatement();

(delete these last two statements and no errors)

Any help is GREATLY appreciated. I had everything running in TC 3.2.3 and 4.1 I thought it would be a good idea and exercise to revisit my code and get some experience with j2se 5.0 and TC 5.5

Not promising if I can't even get past the setup :) Thanks again!

[2060 byte] By [ianjkinga] at [2007-9-23]
# 1

SO...

I created a META-INF folder in my app, and then created a file called context.xml which contained the same code as I had in my server.xml file.

In the documentation http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.html#Common%20Problems

it says that you can use global naming instead of context. Didn't work with global naming but it did work with context. No idea why, just know that it did.

ianjkinga at 2007-7-9 > top of java,Database Connectivity,Java Database Connectivity (JDBC)...