I am upgrading AS7 to Wildfly. The web application began to throw EJBAccessExceptions on all unchecked methods to unauthenticated users. I temporarily added @PermitAll, which made the EJBAccessExceptions go away.
Next step in troubleshooting was to remove the @PermitAlls and add the following to my login module configuration in standalone.xml:
<module-option name="unauthenticatedIdentity" value="guest"/>
However, this configuration change had no effect and the EJBAccessException on unchecked method was thrown.
Next, I set a breakpoint where the exception was thrown and I invoked
ctx.getCallerPrincipal()
which returned a Principal whose name was "anonymous." It seemed to me that the name should be "guest," not "anonymous." Please correct me if I'm wrong.
Next, I created an obvious error in standalone.xml and restarted Wildfly. Wildfly would not restart due to the error I introduced. Therefore, I knew that I added the module-option to the correct configuration file.
Next, I added the following to the EJB class:
@RolesAllowed("guest")
This did not prevent EJBAccessException.
What am I doing wrong? What do I need to change?