aspose file tools*
The moose likes Java in General and the fly likes MYSql Driver ClassNotFound Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "MYSql Driver ClassNotFound Exception" Watch "MYSql Driver ClassNotFound Exception" New topic
Author

MYSql Driver ClassNotFound Exception

Karthik Krishnamurthy
Ranch Hand

Joined: Feb 04, 2005
Posts: 118
Hi,
I am running a web based application using applets.
The applet has to connect to an underlying MYSql database.
I have used DriverManager.getConenction()....

When I run it on my machine as a standalone (in my Netbeans IDE) it runs fine.

I then "jar"ed and loaded the applet on the server in root/htd/lib directory and placed the mysql connector also in the same directory.
But I am getting ClassNotFound Exception

The applet runs fine if I hard code the value I need from the database.

Pl. help

thx
Karthik
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Is your JDBC library Jar in your classpath?


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Karthik Krishnamurthy
Ranch Hand

Joined: Feb 04, 2005
Posts: 118
Hi,
I added the mysql driver to the path but now I am getting the following AccessControlException :

Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)**
BEGIN NESTED EXCEPTION ** java.security.AccessControlExceptionMESSAGE: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)STACKTRACE:java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)at java.security.AccessControlContext.checkPermission(Unknown Source)at java.security.AccessController.checkPermission(Unknown Source)at java.lang.SecurityManager.checkPermission(Unknown Source)at java.lang.SecurityManager.checkConnect(Unknown Source)at java.net.Socket.connect(Unknown Source)at java.net.Socket.connect(Unknown Source)at java.net.Socket.<init>(Unknown Source)at java.net.Socket.<init>(Unknown Source)at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:124)at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:225)at com.mysql.jdbc.Connection.createNewIO(Connection.java:1783)at com.mysql.jdbc.Connection.<init>(Connection.java:450)at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)at java.sql.DriverManager.getConnection(Unknown Source)at java.sql.DriverManager.getConnection(Unknown Source)at vdt.VdtModuleApplet.getConnection(VdtModuleApplet.java:444)at vdt.VdtModuleApplet.init(VdtModuleApplet.java:105)at sun.applet.AppletPanel.run(Unknown Source)at java.lang.Thread.run(Unknown Source)** END NESTED EXCEPTION ** System = Inited, gotParameters, init propertiesGetting Connection
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MYSql Driver ClassNotFound Exception