Two Laptop Bag*
The moose likes Applets and the fly likes java.lang.ClassNotFoundException: com.mysql.jdbc.Driver while executing applet on a web page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver while executing applet on a web page" Watch "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver while executing applet on a web page" New topic
Author

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver while executing applet on a web page

VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
Hi fellow ranchers,

You have been very helpful in past and hope you will help me this time too.
I have a applet which draws some diagrams after receiving some data from a MySQL database. This applet works just fine when run as an applet on eclipse. But when I try to embedd it on a web page, the applet is loaded but nothing is displayed. I receive the following message in java console:
"java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"

I am using jboss 4.2 as web server. I tried moving the "mysql-connector-java-5.1.5-bin.jar" to the required lib folder in jboss directory, but it doesn't help.
What could be the problem??


Copy Paste is a design error!!
Ivan Ivanofff
Greenhorn

Joined: Jul 08, 2009
Posts: 2
Problem is that applet runs at client side, in browser. You must write in HTML (or JSP) page <applet code=".." archive="mysql-*.jar">. Jar not must be located in server's lib directory.
And you must write params for database connect in applet! Do you really want to have access to the database in applet?
VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
Thanks Vladimir for your time, but I had coded the applet tag as you have mentioned. The problem was that the browser was unable to locate the MySql connector jar while loading the applet. I moved the connector jar into the jdk/jre/lib/ext directory and the problem was solved.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41128
    
  45
Just out of curiosity: If you have complete control over the client machine (which you need to have in order to put files into the jre/lib/ext directory), why not make this a standalone desktop application (or WebStart application) instead of an applet?


Ping & DNS - my free Android networking tools app
VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
Ulf,

Actually the application we built, is supposed to be accessesd by a designated group of users over a VPN. Their client system configuration is fully controlled by us, so moving the connector jar to the specified directory was not an issue. Furthermore, the applet display is just a part of the bigger application, which was supposed to be accessible through the network.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver while executing applet on a web page
 
Similar Threads
Error while starting jboss(java.lang.ClassNotFoundException: No ClassLoaders found for: com.mysql.j)
ClassNotFoundException
Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang
JDBC and MySQL Problem
Jar File