Glassfish and MySQL - Connection Issue

Hi all

I recently downloaded the new Netbeans 6.1 including the Glassfish v2 package to replace my previous versions. Once I moved my application to the new platform I had to temporarily deploy the application database from Oracle to MySQL to test on my local machine. My application is built on JavaEE and for the persitence layer I am making use of data access objects (using Toplink) fronted by a set of session beans. After porting the database for testing I started getting the following error:

Internal Exception: java.sql.SQLException: Error in allocation a connection. Cause: No PasswordCredential found

This problem doesn't occur during development within Netbeans (hence all jdbc resources and Persistence units work fine from within netbeans) but occurs on deployment on Glassfish.

From some google searches i found that this problem existed for some time with previous versions but still exists with the latest installation of Netbeans/Glassfish including a bundled MySQL. A solution for this problem is to add the password property manually on the glassfish server -> jdbc -> database connection pools from the Administration Console. Once this is done the error will disappear. To test that this problem exists you can try to ping the database from the msqlpool Administration screen and you notice that on installation the ping gives this error.

Although its a small thing I believe that with the new Netbeans 6.1/Glassfish v2/MySQL bundle Sun can fix this setting by default and hence save some debugging time! 


Spasulato said…
Anonymous said…
It was rather interesting for me to read the post. Thanx for it. I like such topics and everything that is connected to them. I would like to read more soon.
Anonymous said…
tambien hay que editar el archivo sun-resources.xml que esta dentro del proyecto de netbeans alli dentro estan el usuario y password entre otras cosas.
esto es util cuando cambiamos el password de nuestra base de datos y estamos en mode de desarrollo. pero si es para produccion debemos configurar estos parametros en el servidor glassfish en la seccion jdbc pool de conexiones