0 Replies Latest reply on May 5, 2004 9:04 PM by Ronaldo Nascimento

    WARN message when calling sessionContext.isCallerInRole(Stri

    Ronaldo Nascimento Newbie

      Environment: JBoss 3.2.3

      I have a Stateless Session Bean and within one of the business methods, I have code
      that looks something like this:

       * @ejb.interface-method
       * @ejb.permission role-name = "Manager, Director"
      1 public void doSomething() {
      2 Principal loggedUser = sessionContext.getCallerPrincipal();
      4 System.out.println("Logged in user is: " + loggedUser.getName());
      5 System.out.println("role [Manager]: " + String.valueOf(sessionContext.isCallerInRole("Manager")));
      6 System.out.println("role [CEO]: " + String.valueOf(sessionContext.isCallerInRole("CEO")));
       /* etc.... */

      A client will log in via JAAS and call doSomething. Line 4 correctly prints out the username of the user. Note that the user superman has been assigned the role Manager. Line 5 and 6 causes these outputs to the console:

      INFO [STDOUT] Logged in user is: superman
      WARN [org.jboss.ejb.EnterpriseContext] no match found for security role Manager in the deployment descriptor.
      INFO [STDOUT] role [Manager]: true
      WARN [org.jboss.ejb.EnterpriseContext] no match found for security role CEO in the deployment descriptor.
      INFO [STDOUT] role [CEO]: false

      Since I did declare the Manager roles in the assembly-descriptor portion of ejb-jar.xml, why am I getting the Warning on the Manager role. I'd expected to get it for the CEO role which doesn't exist in the ejb-jar.xml. How can I remove these warning messages ?

      Merci beaucoup.