Driver class 'org.gjt.mm.mysql.Driver' not Found JSP

OS ->Windows XP Pro
Tomcat version ->4.0.1
jdk version -> 1.3.1
database -> mysql
Classpath = .;C:\jakarta-tomcat-4.0.1\common\lib\servlet.jar;C:\jakarta-tomcat-4.0.1\common\lib\mm.mysql.jdbc-1.2c\mysql_uncomp.jar;
I am trying to run a function in a javabean to startup up a connection to a database. Code as follows...
public void connect() throws ClassNotFoundException,
SQLException,
Exception {
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
con = DriverManager.getConnection(
"jdbc:mysql://localhost/Wrox ?user=root&password=lunchbox ");
} catch (ClassNotFoundException cnfe) {
error = "ClassNotFoundException: Could not locate DB driver.";
throw new ClassNotFoundException(error);
} catch (SQLException cnfe) {
error = "SQLException: Could not connect to database.";
throw new SQLException(error);
} catch (Exception e) {
error = "Exception: An unknown error occurred while connecting " +
"to database.";
throw new Exception(error);
I call it from my jsp page code as follows.. connect in bold
<%@ page language="java"
import="java.sql.*, java.io.*, java.util.*, com.wrox.databases.*"
errorPage="error.jsp" %>
<jsp:useBean id="book" class="com.wrox.databases.Books" />
<html>
<head>
<title> Wrox Press Ltd. </title>
</head>
<body>
<h1> Wrox Press Ltd.</h1>
<h2> List of Books </h2>
<b>Add More Books</b>
<form action="delete.jsp" method="post">
<table border="1">
<tr>
<td><b>ID:</b></td>
<td><B>Title:</b></td>
<td><B>Price:</b></td>
</tr>
<%
book.connect();
ResultSet rs = book.viewBooks();
while (rs.next()) {
%>
<tr>
<td>
<input type="checkbox" name="pkey"
value="<%= rs.getString("Title_ID") %>" />
</td>
<td><%= rs.getString("Title") %></td>
<td><%= rs.getString("Price") %></td>
</tr>
<%
%>
</table>
Check books for deletion.<BR>
<input type="submit" value="Delete All Checked Books">
</form>
<% book.disconnect(); %>
</body>
</html>
The name of the bean is correct and so is the package it is stored under. I tried it in the bean and got "ClassNotFoundException" Could not locate DB driver". I tried it with DBtags and got
Driver class 'org.gjt.mm.mysql.Driver' not Found
any help would be really appreciated.

When using any 3rd party library with tomcat. the jar file of that library has to be put in the WEB-INF/lib directory of your application. Then only tomcat will find it.
So the my-sql driver would have come in a jar file. just put that jar file in the WEB-INF/lib directory.
After that things should work. If they don't please post again.
hope this helps.
regards,
Abhishek.

Similar Messages

  • Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'

    Hi,
    I'm trying to run my web app and connect to a MySQL database but keep getting this error:
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'
    any ideas?
    Thanks!

    Lookup the stacktrace and find the root cause of the exception.
    My cents on a ClassNotFoundException which is rather self-explaining.
    By the way, the mentioned driver class name is a very old driver. You shouldn't be using that anymore. Surf to the MySQL homepage and download the most recent Connector/J JDBC driver for your database version. Documentation is also available over there.

  • Org.gjt.mm.mysql.Driver not found help!!

    hi all
    it's the first time for me working with MySql, and when i try to connect to the db, i have the following exception:
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    i know that i shall download it from Mysql site, but i don't know WHERE to put it
    i'm using forte 3.0 - jdk 1.4.0 on Win2K
    please help me!
    thanx
    sandro

    No problem,
    in general you should modify the CLASSPATH of your JDK to point to the jar-driver-file, e.g. (on unix): CLASSPATH = "someDirectory"\driverFIle.jar:$CLASSPATH
    and then: export CLASSPATH. That should solve your problem. if using windows: Just take a look at systemControlCenter. There it's possible to modify the CLASSPAT-environment.
    So far...

  • Java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver...the same old pr

    Hi,
    I am a new user in this forum..
    I have just installed tomcat and mysql and jdbc fresh on my new system..
    first of all here is what i have done...
    i have installed mysql integrated in xampp at c:\xampp\mysql
    i have installed my tomcat at C:\Programme\Apache Software Foundation\Tomcat 5.5
    i have put jdbc <dirver>.jar file copied in all sorts of directories like ....
    <tomcat_home>\common\lib
    <tomcat_home>\webapps\axis\WEB-INF\lib\ext
    <java_home>\lib
    <java_home>\jre\lib\ext
    my calsspath looks something like this
    .;C:\Programme\QuickTime\QTSystem\QTJava.zip;C:\Programme\"Apache Software Foundation"\"Tomcat 5.5"\common\lib\mysql-connector-java-5.0.6-bin.jar;C:\Programme\"Apache Software Foundation"\"Tomcat 5.5"\webapps\axis\WEB-INF\lib\mysql-connector-java-5.0.6-bin.jar;C:\Programme\"Apache Software Foundation"\"Tomcat 5.5"\common\lib\servlet-api.jar;C:\Programme\"Apache Software Foundation"\"Tomcat 5.5"\common\lib\jsp-api.jar;C:\Programme\Java\jdk1.5.0_05\jre\lib\ext\mysql-connector-java-5.0.6-bin.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\activation.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\axis.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\axis-ant.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\commons-discovery-0.2.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\commons-logging-1.0.4.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\jaxrpc.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\log4j-1.2.8.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\mail.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\saaj.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\wsdl4j-1.5.1.jar;C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\lib\mysql-connector-java-5.0.6-bin.jar
    which is basically all the jar files in the web-inf\lib folder and references to all the copies of driver as mentioned before
    these are results of a lot of desperatio but still the code which i run....
    package mypackage;
    import java.sql.*;
    public class JDBCConnector
    public static void main(String[] arg) throws Exception
         System.out.println("Initiating Database Mysql Connection");
         //try {
                   Statement stmt;
                        //     Register the JDBC driver for MySQL.
                   Class.forName("org.gjt.mm.mysql.Driver ").newInstance();
                        //     Define URL of database server for
                        // database named mysql on the localhost
                        //      with the default port number 3306.
                   String url = "jdbc:mysql://wifh-1.fhso.ch:3306/";
                        //          Get a connection to the database for a
                        // user named root with a blank password.
                        // This user is the default administrator
                        // having full privileges to do anything.
                   Connection con = DriverManager.getConnection(url,"root", "birnExy");
                        //Display URL and connection information
                   System.out.println("URL: " + url);
                   System.out.println("Connection: " + con);
                        //Get a Statement object
                   stmt = con.createStatement();
                        //     Create the new database
                   stmt.executeUpdate("CREATE DATABASE JunkDB3");
                        //Register a new user named auser on the
                        // database named JunkDB with a password
                        // drowssap enabling several different
                        // privileges.
                   stmt.executeUpdate("GRANT SELECT,INSERT,UPDATE,DELETE," +"CREATE,DROP " +"ON JunkDB3.* TO 'nishant'@'localhost' " +"IDENTIFIED BY 'nishant';");
                   con.close();
         //}catch( Exception e ) {
              //     e.printStackTrace();
         //}//end catch
              //return hook;
         }//end main
    }//end class JDBCConnector
    gives the following error.....
    <soapenv:Envelope>
    &#8722;
         <soapenv:Body>
    &#8722;
         <soapenv:Fault>
    <faultcode>soapenv:Server.userException</faultcode>
    &#8722;
         <faultstring>
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    </faultstring>
    &#8722;
         <detail>
    <ns1:hostname>SADMC0087</ns1:hostname>
    </detail>
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>
    please help me

    20.05.2007 22:43:26 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Programme\Java\jdk1.5.0_05\jre\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\QuickTime\QTSystem\;C:\Programme\ATI Technologies\ATI Control Panel;C:\Programme\Java\jdk1.5.0_05\bin;C:\Programme\Apache Software Foundation\Tomcat 5.5\common\lib;
    20.05.2007 22:43:27 org.apache.coyote.http11.Http11BaseProtocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    20.05.2007 22:43:27 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1203 ms
    20.05.2007 22:43:27 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    20.05.2007 22:43:27 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
    20.05.2007 22:43:27 org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    20.05.2007 22:43:28 org.apache.catalina.startup.HostConfig deployWAR
    INFO: Deploying web application archive SIpages.war
    20.05.2007 22:43:31 org.apache.coyote.http11.Http11BaseProtocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    20.05.2007 22:43:31 org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    20.05.2007 22:43:31 org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/109 config=null
    20.05.2007 22:43:31 org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource
    20.05.2007 22:43:32 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4813 ms
    now this is when i run from eclipse where SIpages.war is my war file to be deployed...which looks something like this
    sipages/web-inf/classes
    sipages/web-inf/src
    sipages/web-inf/lib-this has the jar file as you mentioned
    and come other files...nwo where soes my .java file go in this war and how do i compile the java file

  • Java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver

    hi
    I am facing followig error.
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    How to set the class path.
    I am using Windows XP, NetBeans IDE 5.5, MySQL-5.0
    I have made one simple servlet program in order to read one small table from the MySQL database.
    I got the connectivity but above error is i have been facing.
    Please tell me how to write to set the class path and where should i put my mysql-connector-java-5.0.4-bin file. so i can read the data from the database.
    thanking you.
    regards
    discuss.

    hi
    I am facing followig error.
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    How to set the class path.
    I am using Windows XP, NetBeans IDE 5.5, MySQL-5.0
    I have made one simple servlet program in order to read one small table from the MySQL database.
    I got the connectivity but above error is i have been facing.
    Please tell me how to write to set the class path and where should i put my mysql-connector-java-5.0.4-bin file. so i can read the data from the database.
    thanking you.
    regards
    discuss.

  • Including org.gjt.mm.mysql.Driver with my application

    So, lets say I have a Java program that connects to an SQL server and it runs fine on my machine. I have all the nessicarry classpath's and Connector/J properly installed. But, when I run it on a client machine I get:
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.DriverNow, I can solve this issue by putting the Connector/J onto their computer but, I'm wondering if there's a way to package the application and the driver so that anyone can run it without having to install Connector/J manually.
    Any help would be much appreciated.
    Thanks!

    JonasWon wrote:
    So, lets say I have a Java program that connects to an SQL server and it runs fine on my machine. I have all the nessicarry classpath's and Connector/J properly installed. But, when I run it on a client machine I get:
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    That's the old, deprecated JDBC driver class name.
    Now, I can solve this issue by putting the Connector/J onto their computer but, I'm wondering if there's a way to package the application and the driver so that anyone can run it without having to install Connector/J manually.
    Any help would be much appreciated.
    Thanks!"install" it manually? Nobody "installs" a 3rd party JAR. These aren't quite DLLs.
    I'll assume your app is a desktop deployment. Package it into an executable JAR, add the Connector/J JAR to the Classpath in the manifest, and zip that JAR up with the Connector/J JAR. Your users will just unzip the ZIP file and execute the JAR.
    %

  • Org.gjt.mm.mysql.Driver

    I want to send a WAR file of my web applications to my clients. The application consiting of servlets and jsps connects to a database and requires org.gjt.mm.mysql.Driver how do i incorperate the .jar inside the WAR so my client doesn't have to fiddle with dropping jars in tomcats lib directory? I've tried including the org.gjt.mm.mysql.Driver driver jar inside the war WEB-INF/lib but it still says it cant find the driver?

    If you have set up connection pooling within Tomcat, there is no way around it. The connection pooling is controlled by Tomcat, so it requires the driver file in [TOMCAT]/common/lib.
    The only way to have a completely independant WAR file would be to handle all the database connections and connection pooling yourself within the web application.

  • Help. JDBCRealm error -- org.gjt.mm.mysql.Driver not found

    Hi All,
    I tried to setup JDBCRealm. After I config. to JDBCRealm and restart tomcat. I got this error:
    java.sql.SQLException: org.git.mm.mysql.Driver error.
    Can someone help. Thanks

    web-inf/lib is not sufficient in this case, as the Tomcat engine needs access to the driver - not just your application.
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html#JDBCRealm
    You need to
    Place a copy of the JDBC driver you will be using inside the $CATALINA_HOME/server/lib directory (if you do not need it visible to web applications) or $CATALINA_HOME/common/lib (if it will be used both by Tomcat 4 and by your apps).
    Cheers.
    evnafets

  • Java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver when using RMI

    I am trying to connect to mysql Db through RMI but i am getting this exception.
    When trying to connect to db through a normal class implementation without RMI it is connected succesfully.
    What is causing the problem????
    Thanks in advace

    CLASSPATH, man. The RMI server needs to have the MySQL driver JAR in its CLASSPATH.
    That's usually what that exception means.
    %

  • Org.gjt.mm.mysql.Driver under tomcat?

    hi all
    anybody knows where to put this driver under tomcat in order to let my servlet connect to a MySql db?
    thanx all
    sandro

    sandro
    Put the driver on "lib/common/" directory of Tomcat, and since lib is directly located by tomcat when you restart it. You must have to restart the tomcat after copying the file. The folder path may be "/var/tomcat/lib/commomn/" and may vary during installation.
    Cheers
    Rahul//

  • Org.apache.struts.action.ActionServlet not found in web-application

    Dear All,
    I am new to ADF environment. I tried to create a simple page to show the records from
    a table . I followed the sample application which is available in "Building Oracle ADF Applications: Workshop".
    When i run my action from Struts Page Flow. It is giving error like
    500 Internal Server Error
    Servlet error: Error instantiating servlet 'action'. Servlet class org.apache.struts.action.ActionServlet not found in web-application EmpMaintanance-ViewController-webapp
    anybody can suggest me What i missed?
    Thanks in advance...

    Hi,
    you need to register libraries with th OC4J configuration files. However, you can also deploy the Struts library with you application (see OC4J documentation which is accessible on OTN via Oracle As documentation), in which case they are available from the application classpath
    Frank

  • OSMF 1.5 - VerifyError: Error #1014: Class org.osmf.media::MediaFactory could not be found.

    Hi
    I'm compiled osmf 1.5 player - OSMFPlayer project for http streaming, using chromeLlibrary and OSMF.swc. I generated OSMFPlayer.swf without any errors, but when I'm trying to use this file I get a lot of errors with the player
    VerifyError: Error #1014: Class org.osmf.media::MediaFactory could not be found.
    VerifyError: Error #1014: Class ILayoutTarget could not be found.
    VerifyError: Error #1014: Class org.osmf.layout::LayoutTargetSprite could not be found.
    etc..
    Can anyone please explain anything I need to do at compile time to get these errors fixed.
    Vishal

    this has been answered here: http://forums.adobe.com/message/3297456

  • Record drive/partition "500G Ext HD Western Digital" not found!

    I don't know why I'm getting this message when I open any songs I've recorded in Logic Express. It just started doing this today. Here is the message:{Record drive/partition “500G Ext HD Western Digital” not found!}
    I do not get this message when I open and work on songs I've recorded in Garageband.
    The 500G Ext HD is my external hard drive.
    Does anyone know what this means and how I can resolve it and get back to recording music??

    Does the disk appear OK on your desktop?
    When exactly do you get this message? When you double-click on a Logic file on your external drive? Or when you start a new project? Is your record path set properly in Logic?
    First, as you may be nearing a hard disk problem, make sure that all essential files are backed up properly.
    Then, open up your Disk Utility and run 'Verify Disk' and 'Repair permissions' on your external drive. If you have a copy of Disk warrior, even better.

  • Class oracle.xml.sql.query.OracleXMLQuery not found in import

    I tried to perform load java using a non-sys user :
    loadjava -user user1/passwd -v -o -r Archive.java
    but encountered the following error:
    Errors in Archive:
    ORA-29535: source requires recompilation
    Archive:11: Class oracle.xml.sql.query.OracleXMLQuery not found in import.
    Info: 1 errors
    loadjava: 3 errors
    But if I use sys user I don't have any error:
    loadjava -user sys/manager -v -o -r Arachive.java
    initialization complete
    loading : Archive
    creating : Archive
    resolver :
    resolving: Archive
    Why is this so?
    ANy security setup that I missed?
    Thanks in advance.
    Note:
    my Archive.java file contains:
    // Core Java Classes
    import java.io.*;
    import java.sql.*;
    // Oracle Java classes
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Azman Diron ([email protected]):
    I tried to perform load java using a non-sys user :
    loadjava -user user1/passwd -v -o -r Archive.java
    but encountered the following error:
    Errors in Archive:
    ORA-29535: source requires recompilation
    Archive:11: Class oracle.xml.sql.query.OracleXMLQuery not found in import.
    Info: 1 errors
    loadjava: 3 errors
    But if I use sys user I don't have any error:
    loadjava -user sys/manager -v -o -r Arachive.java
    initialization complete
    loading : Archive
    creating : Archive
    resolver :
    resolving: Archive
    Why is this so?
    ANy security setup that I missed?
    Thanks in advance.
    Note:
    my Archive.java file contains:
    // Core Java Classes
    import java.io.*;
    import java.sql.*;
    // Oracle Java classes
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    <HR></BLOCKQUOTE>
    Managed to solve this problem.
    Drop all xml objects owned by sys and user1.
    Reload xml objcets for user1 with -force option.
    null

  • Exception :Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found

    Hi All,
    I run my application on Redhat Linux 2.4.9-e.27smp using java appname. I'm using JDK1.4.2 and am not using any app server. The app seems to run just fine for a few hours and then I start getting Exception :Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found exception out of blue. I run the app with following parameters -
    java -server -XX:+UseAdaptiveSizePolicy -Xverify:none -Xms512m -Xmx512m -XX:+UseParallelGC -XX:ParallelGCThreads=4
    I suspect this has to do with garbage collection and can't replicate this on will. I wonder if anyone has come across similar issue and is able to point me to the right direction.
    Thanks for any help,
    Vishal Bhasin

    Quick question. I am receiving the following error too:
    Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
    I am getting this error intermitently. Do you have any idea why this would happen. I am using an add on to a program.
    Thanks,
    Joe

Maybe you are looking for

  • Error import Adaptive Web Service Modal

    Hi, i´m doing an tutorial of import Adaptive Web Service Modal, but when i create the model and write the link: http://www.abysal.com/soap/AbysalEmail.wsdl in the top appear "Error in loading the WSDL file. Check the error log for more details". I se

  • X79A-GD45 Secondary Hard Drive Not Recognized

    Hi, I actually had this problem from the very beginning when I bought it a year ago, but it wasn't such a big deal because I worked around it (I was needing to clone my hard drive - I made a back up on an external hard drive, removed the source drive

  • Sending the same data to multiple receivers.

    Hi, In 7.1, I did a simple file-to-file scenario with mulitple receivers.I used only 1 Rcvr Det.(included multiple business components) and 1 Interface Det. without BPM and it works.I would like to know if there's any other way to send same data to m

  • Premiere 7 (Will not Start-up)

    Computer: HP m7580n (UPGRADED) 320 GB Internal HDD, 1TB External HDD, NVIDIA 9800 GT GPU, Dualcore AMD CPU 3.0 GHz, 4GB of RAM, XP Pro (SP 3.5). Problem: On startup the large purple PE block runs sweeping through the executables at the bottom of the

  • Different senders in email sent by forum

    hi, i noticed that the forum send me email (notification from subscribed thread) with two different email senders: Arch Linux Forums Mailer ([email protected]) OR Mailer ([email protected])