Glassfish and MySQL - Connection Issue
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!