• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic