Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Glassfish SQLException: Error in allocating a connection in MySQL

htran_888Mar 4 2009 — edited Dec 14 2009
Hi All,

I have just installed the Bundled Netbeans 6.5, Glassfish v2 and v3 Prelude (not including MySQL) that runs on top of MySQL 5.1 (separate installation) on server A, in order to mirror another similar working installation (Bundled Netbeans 6.1, Glassfish v2 including MySQL 5.0) on server B. Both Windows XP servers have got identical setups in their respective C:\Program Files\glassfish-v2ur2\domains\domain1\config\domain.xml files. However, the following error was encountered when trying to deploy the same EnterpriseApplication on server A which had no such problem on server B:
Glassfish Server Log
Server: unknown
RAR5099 : Wrong class name or classpath for Datasource Object 
java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1498)
        at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:251)
        at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:106)
RAR5038:Unexpected exception while creating resource for pool mysqlPool. Exception : Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
RAR5117 : Failed to obtain/create connection from connection pool [ mysqlPool ]. Reason : Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
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.MysqlConnectionPoolDataSource]
Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: 
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Error Code: 0
        at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)

EnterpriseApplication (EJB 3.0) Deployment output
Deploying application in domain failed; Deployment Errorjava.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource -- 
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Error Code: 0
C:\Documents and Settings\Jack\EnterpriseApplication\EnterpriseApplicationBean-ejb\nbproject\build-impl.xml:400: The module has not been deployed.
Even manually re-creating the same project (as opposed to getting a copy of the Netbeans project folder from server B) did not make any difference. Likewise, the following jdbc connection pool definition was added possibly by Netbeans from Server Database JDBC Connection Resource setting:
      <property name="URL" value="jdbc:mysql://localhost:3306/employeeDB"/>
      <property name="driverClass" value="com.mysql.jdbc.Driver"/>
      <property name="Password" value="abcdef"/>
      <property name="portNumber" value="3306"/>
      <property name="databaseName" value="employeeDB"/>
      <property name="serverName" value="localhost"/>
      <property name="User" value="applicationuser"/>
Can anyone see where the problem lies?

Any assistance would be much appreciated.

Thanks in advance,

Jack
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2010
Added on Mar 4 2009
6 comments
2,120 views