Responding to both ...

Being guided by your judgements I have made a few adjustements and re-tried.
1. I removed the mysql driver jar from my jse/jre/lib/ext
2. I confirmed hibernate3.jar is in myapp/WEB-INF/lib.  It has always been 
there.
3. I put mysql-connector-java-3.1.10-bin.jar back into WEB-INF/lib
4. I did a "find" scan of my system, looking for other copies of both 
hibernate3.jar and mysql-connector-java-3.1.10-bin.jar to
confirm there are no other copies which could be in classpath. I found no other 
copies which could be in classpath, given the
tools I am using.  well ... wait.  There is a link to the mysql driver jar in 
hibernate-3.0's own lib directory.  Hmmmm.  I wonder
if that could be confusing hibernate? Since it is a link, I must have put it there a year or so ago. I did not remove the link. 5. I re-built the war file and re-deployed.
6. When I re-run the application, I am right back where I was.  I get 
"java.lang.ClassNotFoundException: com.mysql.jdbc.Driver".
My webapp cannot see the mysql driver jar, although it clearly sees the 
hibernate jar.  Hibernate code is what is running and
attempting to load the driver.

Suggestions, gents?

David Smith wrote:
You are right ... it shouldn't be put there.  One thing you didn't seem
to mention is how you are using your mysql driver.   Are you trying to
use the built-in database pooling?  If that's the case, the mysql driver
should be in tomcat's lib directory because tomcat's internals need
access to it as well.

I expect to use C3P0 pooling.  I have the c3p0-0.8.5.2.jar in WEB-INF/lib.  My 
understanding is that Hibernate will use C3P0 if it finds the c3p0 jar in 
classpath.  However, I haven't really detailed the pooling, other than setting 
a configuration for the pooling:
maxActive="10" maxWait="5000" maxIdle="4" I would expect to detail pooling as a later optimization once I have everything else working.

 Also can you offer some detail about your use of
hibernate?  If it's in your webapp, it should easily see the driver jar
file.  If it's in another webapp, it won't.
The hibernate3.jar is in WEB-INF/lib, so based on the comments by both of you 
the application should see it, but it doesn't.  See below.


--David

Caldarale, Charles R wrote:
From: Bob Marcum [mailto:bmar...@bcscomputers.com]
Subject: Seeking the right solution to
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

That would mean code directly in my app could see all the
jar files in WEB-INF/lib but hibernate code, for instance,
could not ?? !!


Depends on where the Hibernate jar is located.  If you've put that in the 
webapp's WEB-INF/lib directory, you shouldn't have a problem.
 If you've placed the Hibernate jar in some other location, you will need to 
put the MySQL jar in the same place.

hibernate3.jar is in WEB-INF/lib and has always been there.



A solution I found to work is to copy the mysql-connector-java-3.1.10-
bin.jar file into my jseHOME/jre/lib/ext directory.


Be very, very careful if you copy jars - in this case you want to move it, not 
copy it.
Having the same jar in multiple locations on a given branch of the classloading 
tree will result in never ending errors.
If your Hibernate jar is in jre/lib/ext, then, it's likely you will have to put 
the MySQL jar there.
The Hibernate jar really belongs with your webapp, not in any more global 
location.

I agree completely with your judgments expressed here, but that approach seems 
not to work, in my case.  Why?


 - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to