Connecting a MySQL database to Glassfish classpath is not set or classname is wrong

I've also added the MySQL driver .jars to the library of glassfish in both projects.

It was apparently not done right. The JAR has to go in /glassfish/domains/[domainname]/lib/ext folder of the Glassfish installation where [domainname] usually defaults to domain1. You can and should not configure it from the Eclipse side on.


Looks like I am replying very late, but however people who would be referring to this thread may find the following information being useful. So I am posting it here:

  1. Download the connector Jar from http://dev.mysql.com/downloads/connector/j/5.0.html
  2. unzip the pack and copy mysql-connector-java-verno-bin.jar
  3. past the same at [GlassFish Installation Directory]/domains/[domain name]/lib folder
  4. restart your domain and ping to check your connection in JDBC Connection Pools

There you go. If your MySql is running then it will ping the DB successfully


I copied the jar file to $glassfish_install_folder\glassfish\lib, after that it worked. I use glassfish 4.0.

Check this link from oracle.