title: Glassfish / Payara javax.ejb.AccessLocalException: Client not authorized for this invocation in server.log
body: <p>I was trying figure out the cause of another exception for my dynamic web app here - <a href="https://github.com/double-whammy/affablebean" rel="nofollow noreferrer">https://github.com/double-whammy/affablebean</a>
  I made a small change and I got a new exception - javax.ejb.AccessLocalException: Client not authorized for this invocation</p>
  
  <p>An online answer says that I do the following - <a href="http://ask.ozar.net/11/javax-accesslocalexception-client-authorized-invocation" rel="nofollow noreferrer">http://ask.ozar.net/11/javax-accesslocalexception-client-authorized-invocation</a></p>
  
  <p>Try deleting the generated policy file(s). You should be able to locate them under C:\glassfish-3\glassfish\domains\domain1\generated\policy.
  substitute your domain name with domain1</p>
  
  <p>Another says more - <a href="http://glassfish.10926.n7.nabble.com/Persisting-Entity-javax-ejb-AccessLocalException-Client-not-authorized-for-this-invocation-td11197.html" rel="nofollow noreferrer">http://glassfish.10926.n7.nabble.com/Persisting-Entity-javax-ejb-AccessLocalException-Client-not-authorized-for-this-invocation-td11197.html</a></p>
  
  <p>you can find the policy file under domains/domainx/generated/policy///{granted.policy,excluded.poliy}
  positive grants are in granted.policy, negative grants are in excluded.policy (if any). (In domaninx, x =1,2,3 etc...)</p>
  
  <p>look in granted.policy for an "unqualified grant of an EJBMethodPermission, with name = the EJbName of your session bean; which 
  I think may be JpaPersonDao. and with a method spec that applies to the save method.</p>
  
  <hr>
  
  <p>I tried the second one and I see many folders under my glassfish folder: 
  C:\glassfish4\glassfish\domains\domain1\generated\policy</p>
  
  <pre><code>C:.
  ├───AffableBean
  │   ├───AffableBean
  │   │       granted.policy
  │   │
  │   └───AffableBean_internal
  │           granted.policy
  │
  ├───__admingui
  │   └───__admingui
  │           excluded.policy
  │           granted.policy
  │
  └───__default-web-module
  └───__default-web-module
          granted.policy
  </code></pre>
  
  <p>As you can see, there are so many granted.policy files. Which one should I fix ? Is it the one under first folder ?</p>