I have been searching for a solution to this for a while, here goes...
I followed this tutorial to auto generate a jax-rs web service from a database: https://netbeans.org/kb/docs/websvc/rest.html
This works great, but when I try to secure the application by annotating the resource methods with @RolesAllowed("myRole"), I get this exception...
"WARNING: EJB5184:A system exception occurred during an invocation on EJB LicenceFacadeREST, method: public java.util.List resources.LicenceFacadeREST.findAll() WARNING: javax.ejb.AccessLocalException: Client not authorized for this invocation"
I have narrowed it down to the EJB JACC policy check failing. When I do not use EJB/JPA in a resource class, the exception isn't thrown even when the @RolesAllowed annotation is present.
The full glassfish stack trace in fine print can be found here http://pastebin.com/AUPKWaqe