4 Replies Latest reply on Jul 16, 2005 2:51 AM by jaikiran pai

    Troubles when mben invokes method of a secured local ejb

    Anton Popov Newbie

      Hi all,

      I have one mbean and one local secured ejb.
      Both of them are working in same security domain.

      I want to invoke a method of this local ejb from my mbean.

      I do the following:

      1. From my bean I log on in my security domain as usual, by using "UsernamePasswordHandler" or custom "AppCallbackHandler".
      Login is successfull.

      2. I create local home:
      ReceiptLocalHome receiptnHome = (ReceiptLocalHome)initContext.lookup("ReceiptBeanLocal");

      This is also successfull.

      3. I create the bean:
      receipt = receiptnHome.create();

      This line fails with:
      "javax.security.auth.login.FailedLoginException: No matching username found in Principals"

      In my "ejb-jar.xml" I have roles, method permissions, etc.

      In my "login-config.xml" I have the following security domain:

       <application-policy name = "ReceiptSecurityDomain">
       <login-module code =
       "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag ="required">
       <module-option name =
       <module-option name = "dsJndiName">java:/ReceiptDS</module-option>
       <module-option name = "principalsQuery">SELECT password FROM Principals WHERE username=?</module-option>
       <module-option name = "rolesQuery">SELECT roles, 'Roles' FROM PrincipalRoles WHERE username=?</module-option>

      Can someone help me where could be the problem?