Ravana
Ravana

Reputation: 415

Netbeans Java EE SQL Driver not found

Hey I made an EJB program and I created entity classes form my SQL database. Everything worked fine and it can connect to my database, but I get this error now for some reason. Im using glassfish v3 and netbeans ide 6.8

WARNING: Can not find resource bundle for this logger.  class name that failed: com.sun.gjc.common.DataSourceObjectBuilder
SEVERE: jdbc.exc_cnfe_ds
java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource

more random errors here.

WARNING: RAR5038:Unexpected exception while creating resource for pool mysql_carrent_rootPool. Exception : javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ mysql_carrent_rootPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource]
WARNING: Could not obtain connection metadata
java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource

I dont understand why it wont find the classpath even though it made my entities from the DB and my program worked before. I didnt change anything maybe for some code, but nothing with classpaths or even the database. Thanks for your time!

Upvotes: 3

Views: 4548

Answers (1)

duffymo
duffymo

Reputation: 309008

It's not in the CLASSPATH. You should not assume that because something worked in one scenario that it'll be fine for another. You didn't set things up properly; believe the JVM.

Either Glassfish or NetBeans isn't doing the right thing. It's CLASSPATH - figure it out.

Is this a web app? Is the MySQL JAR in the WEB-INF/lib directory of your WAR? If not, put it there.

Does Glassfish demand that JDBC driver JARs go in a server /lib directory? If yes, put it there.

Is that driver class name correct? That's not what I use to connect to MySQL. Why do you think that's correct? Check it.

Upvotes: 5

Related Questions