Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish 4 no password credential for resource

I have set up a project to use Glassfish 4 with a resource that links back to a MySql database and I am using Eclipse Keplar. I have set up the connection pool with the relevant details and pinging it from the glassfish admin page succeeds. I have an EJB project with JPA set up to access the resource but when access is atempted either in a browser or Eclipse I get a "No database selected" error.

After searching around I found that there are issues with the Url parameter of the pool and renaming that parameter to URL might solve it. the post I found also suggested that I enter the connection string as he suspected that different calls were being made and the string was not getting constructed correctly outside of Glassfish. I did these things but I then get an error "No Password Credential" even though I do have the password entered in the connection string.

Has anyone else encountered this and have any advice as to what the problem is and how I can solve it?

like image 412
onesixtyfourth Avatar asked Nov 01 '22 10:11

onesixtyfourth


2 Answers

For me, editing the URL and Url parameters didn't work. However after restarting Glassfish (domain), the problem disappeared.

like image 65
Kelli Avatar answered Nov 04 '22 07:11

Kelli


I have figured this out and it was the url value that needed to be set correctly. I didn't need it all but I did need to set the server and database name on it:

jdbc:mysql://localhost:3306/<DB Name Here>

I had changed the parameter name to URL from Url but it turns out that this is not required.I have no idea why this step is required as the values are all there in other parameters and the ping succeeds from the admin pages.

like image 44
onesixtyfourth Avatar answered Nov 04 '22 08:11

onesixtyfourth