Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat4 cann't find MySQL driver

 
cnranger
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why cann't Tomcat4 find MySQL driver which I put in WEB-INF\classes directory?
my bean words fine as a standalone application(CLASSPATH setting is fine), but when I try to use it in my JSP page, Tomcat just cann't find the Driver class, even thought I put org.git.mm.mysql directory structure under my web applicaiton's WEB-INF\classes directory.
Class.forName("org.gjt.mm.mysql.Driver").newInstance();

Help please!!! I have been working on it for the past 2 days ( without sleep).
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Yes I just installed Tomcat 4.0 and the documentation doesn't say exactly what dir to put the MySQL driver in.
Anyone got it working who could tell us where to put it? (the file that is )
Bye,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE:
Further testing and searching in the MySQL driver suggested long filename in CLASSPATH might be responsible so I altered the driver directory but it still doesn't work!.
BTW I'm trying on both W98 and Linux (Suse 7.2 Professional) as I have each OS installed on a separate hard disk. I have jswdk-1.0 working perfectly under both OS with database access but it doesn't support latest JSP and Servlet features and it's slow - very slow.
Any help will be apreciated.
Thanks,
Terry
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Just brining this up tio the top again as I still haven't found the solution.
As far as I can see the MySQL dirver has to be in the classpath for Sun's JSWDK-1.0 server to work ( and it does ), so why can't Tomcat find it?

Anyone out there see what I'm doing wrong?

Thanks,
------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
Steve Campbell
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I put the My Sql driver into the Jakarta\lib directory.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Steve.
I found a reference to putting the .jar file in the lib directory on a help page elsewhere yesterday and it's now working fine.
Terry
 
Beaumont Muni
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the documentation the driver can be placed in several places under tomcat depending on your intention. The $CATALINA_HOME/common/lib directory an area where you can place jar files if you intend to share it amoungst other applications that you might create under tomcat 4.x. If you intend to use the driver specifically for an application and not share it out, then create a lib directory under the WEB-INF directory of your application (context) and place it there. I currently have my mm.mysql-2.0.6.jar file located in the D:\Apache Tomcat 4.0\common\lib area on windows 2000.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic