4 Replies Latest reply on May 21, 2004 11:08 AM by starksm64

    Authentication exception & MDB

    sergmesh

      Hello All,

      I have created my login module as a wrapper to external security system.

      everything work well except MDB
      I can navigate and work correctly but when a MDB start to work exception below rises

      11:31:00,906 ERROR [LogInterceptor] EJBException, causedBy:
      java.lang.SecurityException: Authentication exception, principal=null

      below is excerpt of my ejb-jar file
      <message-driven >
      <![CDATA[This message bean is responsible for creaing e-mail messges from hotRADD.]]>

      <ejb-name>NotificationBean</ejb-name>

      <ejb-class>com.infpwr.fe.engine.ejb.NotificationBean</ejb-class>

      <transaction-type>Container</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      </message-driven-destination>

      <resource-ref >
      <res-ref-name>mail/DefaultMail</res-ref-name>
      <res-type>javax.mail.Session</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </message-driven>

      What did I do wrong ?

      Thank you

      Sergey

        • 1. Re: Authentication exception & MDB
          drcharris

          Message Driven Beans essentially run anonymously, since they aren't called by any user code but only in response to JMS messages. This means that MDB invocations don't have an identity associated with them unless you specifically assign one in your bean configuration.

          It's likely that your MDB calls other code which requires authentication (like another EJB), which is why you get the SecurityException.

          You might be able to configure the MDB with a run-as identity in the deployment descriptor, and assign it a specific user name.

          • 2. Re: Authentication exception & MDB
            urunkulia

            Hi, drcharris

            i have the same problem with mdb and authorization.

            I have a mdb and try to create a session bean from my mdb. But an authentication exception, principal=null is thrown, when i try to call 'mySessionHome.create();'

            In the deployment descriptor i have configured the mdb to use another identity with run-as. My Security configuration is configured with DatabaseServerLoginModule in login-config.xml. Login and Authentication runs fine as long as I don't use MDBs.

            You wrote:


            You might be able to configure the MDB with a run-as identity in the deployment descriptor, and assign it a specific user name.


            How can I assign a user name to the role that is specified in the deployment-descriptor with run-as?

            Any help would be appreciated.

            urunkulia

            • 3. Re: Authentication exception & MDB
              milasx

              I have the same issue here. Did you manage to solve it?

              Many thanks!!!!

              • 4. Re: Authentication exception & MDB
                starksm64

                See the unauthenticatedIdentity usage in the JAAS Howto.