Setup the role in GlassFish
Open a browser and go to http://localhost:4848. If the admin console isn’t there, you most likely need to start GlassFish first. To start GlassFish, go to the Services tab. Expand the Servers node. Right-click GlassFish Server 3+ and select Start.
In the admin console, go to Configurations > server-config > Security > Realms > file. Click on Manage Users > New… In the User ID field, type user. In the Group List field, type someone. In the password fields, type password. Click OK. Your users table should now look something like this:
If you’re smart, then you’ve probably noticed that we put our user into a group, we didn’t assign him a role. Our EJB authenticates a role and not a group. The quick fix is to go back to the Security page and check the option Default Principal To Role Mapping. This will kind of make our group become a role 🙂 Don’t forget to click on the Save button!