2 Replies Latest reply on Dec 5, 2008 2:48 AM by Frans van Niekerk

    isCallerInRole throws IlligalStateException

    Frans van Niekerk Newbie

      When I try to use isCallerInRole the following exception is thrown

      java.lang.IllegalStateException: isCallerInRole() called with no security context.
      Check that a security-domain has been set for the application.
       at org.jboss.ejb3.BaseSessionContext.isCallerInRole(BaseSessionContext.java:215)


      But when I use the @RolesAllowed annotation it works the way it should. I generally prefer to use the annotations but there are situations where the role required is not constant. For those scenarios isCallerInRole comes in handy.

      JBoss version: 4.2.2.GA
      LoginModule:
      org.jboss.security.auth.spi.UsersRolesLoginModule
      and a custom login module as well.

      Any help will be appreciated.