aspose file tools
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Applets
Reply 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: 35253
    
    7
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?


Android appsImageJ pluginsJava web charts
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver while executing applet on a web page
 
Similar Threads
JDBC and MySQL Problem
ClassNotFoundException
Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang
Jar File
Error while starting jboss(java.lang.ClassNotFoundException: No ClassLoaders found for: com.mysql.j)