Wednesday Jul 23, 2008

Issues while Connecting GlassFish and MySQL (Netbeans 6.1)

I downloaded the Netbeans 6.1 which was bundled with GlassFish v2 UR 2 and MySQL 5.0 
Community Server and was playing around with it. I created a simple JSP with a dropdown. 
This dropdown has values populated from a table.  

When I ran this, I got the following error - 

RAR5038:Unexpected exception while creating resource for pool mysqlPool. Exception 
: No PasswordCredential found
RAR5117 : Failed to obtain/create connection from connection pool [ mysqlPool ]. 
Reason : No PasswordCredential found
RAR5114 : Error allocating connection : [Error in allocating a connection. 
Cause: No PasswordCredential found]
WebModule[/WebApplication1]java.sql.SQLException: Error in allocating a connection. 
Cause: No PasswordCredential found
java.lang.RuntimeException: java.sql.SQLException: Error in allocating a connection. 
Cause: No PasswordCredential found
        at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow
(CachedRowSetDataProvider.java:416)

I opened up the Admin console of the GlassFish and tied to ping 
(Resources -> JDBC ->Connection Pools -> mysqlPool )

It threw a “No passwordCredentials found” error. As expected.

Then, I moved on to the “Additional properties” and tried adding password as a new property. 
I set the “Password” property to have a blank value as during installation of MySQL, I let the default 
password be(which was a blank password). This seemed to be a mistake, because it is not possible to add 
“Password” as a new property and set the value to be blank.

Thus, I logged into MySQL and set the password - 

C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin>mysql -u root mysql
Welcome to the MySQL monitor.  Commands end with ; or \\g.
Your MySQL connection id is 18
Server version: 5.0.51a-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

mysql> SET PASSWORD FOR root@localhost=PASSWORD('newpassword');
Query OK, 0 rows affected (0.23 sec)


After this, added the new password in Admin console.I clicked on “Save” both in the “additional properties” 
page and also in the “General” page. 

I tried pinging now, and it worked fine. However, when I ran the application, it threw a 
“NoPasswordCredentials found” exception again.

I logged into “Admin Console” again, but could not find the “Password” property I had set. 
I tried a few times, but the password property kept disappearing. 

I tried a lot of things – restarting GlassFish/creating a new JDBC resources and new connection 
pool/ changing the property files....nothing worked.

I had to create a new web application project to solve this problem.  


About

157438

Search

Categories
Archives
« July 2008
SunMonTueWedThuFriSat
  
1
2
3
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
24
25
26
27
28
29
30
31
  
       
Today