3
votes

We have a project made in netbeans 7.3 and are about to deploying this to a remote glassfish server, everything is configured and set up properly and the connection pools for our project are also generated in glassfish.

Currently we are getting this error when deploying to the remote server:

deploy?DEFAULT=D:\SVN\PTS62\Applicaties\Rekeningrijderwebsite\RekeningRijder\dist\RekeningRijder.war&name=RekeningRijder&contextroot=/RekeningRijder&force=true failed on GlassFish Server 3+

Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException

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.MysqlDataSource

Error Code: 0. Please see server.log for more details.

And the message the server generates:

Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource

            at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:292)

            at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114)

            at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1307)

            at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163)

            at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102)

            at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)

            ... 62 more

Google wasn't very helpfull before, so hopefully you guys/girls can help me

Thanks in advance!

2

2 Answers

7
votes

You may need a mysql / java connector.

You can find it there. Extract the mysql-connector-java .jar from the archive. Then place it into the glassfish external lib directory {INSTALL DIR}/glassfish/domains/domain1/lib/ext.

Restart your glassfish server.

There are more details on this answer. If that's not what you are looking for, or if it doesn't work, tell us. @+

1
votes

Right, you just lack mysql lib, just find and download mysql-connector-java-5.x.x-bin.jar copy to E:\Projects\glassfish3.1.1\glassfish\lib then restart server and enjoy !!!