El nombre de la clase es incorrecto o la ruta de clase no está configurada para: com.mysql.jdbc.Driver

I want to configure glassfish with my db. I create jdbc ressource like this:

  • jndi name: jdbc/MysqlDataSource
  • pool name : MysqlConnPoll

And i create my connection pool like this:

  • Pool Name: MysqlConnPoll
  • Ressource type: java.sql.driver
  • Driver classname: com.mysql.jdbc.driver

in Additional Properties

  • databaseName: name_db
  • usuario: root
  • password: ****
  • url: jdbc:mysql://localhost:3306/name_db
  • Puerto: 3306
  • ServerName: localhost

añado mysql-connecter-java y com.mysql.jdbc in "glassfish4/glassfish/domains/domain1/lib/ext"

And when i ping my connection with the site glassfish, i have this message

Ping Connection Pool failed for MySqlConnPoll. Class name is wrong or classpath is not set for : com.mysql.jdbc.Driver Please check the server.log for more details.

Why i have this message ? i forgot something ?

gracias

preguntado el 24 de mayo de 14 a las 14:05

2 Respuestas

it seems that your driver name is wrong.

For ConnectorJ version 8 try:

com.mysql.cj.jdbc.MysqlDataSource

For older ones:

com.mysql.jdbc.jdbc2.optional.MysqlDataSource

This is how to configure the Nombre de clase de fuente de datos field for MySQL 8:

Datasource Classname setting

Respondido el 18 de diciembre de 22 a las 20:12

I've just learnt JDBC last week, not sure I can help.

I have got something like this too after creating a new domain in glassfish4.0 and try to create a connection pool with that new domain. After a few tries and errors, I got it to work.

I added the connector .jar in "glassfish4/glassfish/domains/domain1/lib" rather than inside the "glassfish4/glassfish/domains/domain1/lib/ext" like you mention. Maybe you can try that and see.

not sure if this help: while connecting to database, I also use the same .jar (meaning pointing to the same file) when specifying the driver.

Respondido el 04 de junio de 14 a las 17:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.