Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
VineetK Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Ivan Ivanofff
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
VineetK Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic