2 Replies Latest reply on Jul 17, 2013 3:29 AM by sarah Aldhen

    Using programmaticLogin in arquillian

    sarah Aldhen Newbie

      I'm trying to use ProgrammaticLogin to simulate a login of a user.


      I added the following line in my code before tests: System.setProperty("java.security.auth.login.config", "login.conf");

      in this file ia have :


      JDBCRealm {

                 com.sun.enterprise.security.auth.login.JDBCLoginModule required;



      when running my test i get this exception:


      SEVERE: SEC9050: Programmatic login failed

      com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Aucun LoginModule configuré pour fileRealm


      I dont understnd why arquillian try to use fileRealm instead of jdbcRealm ??

        • 1. Re: Using programmaticLogin in arquillian
          Aslak Knutsen Master

          You might be setting it to late when you set it in your test code. The server is already started at that point.


          Try setting it as a system property in Surefire if you use Maven. Then that property should be set when the container starts up.

          • 2. Re: Using programmaticLogin in arquillian
            sarah Aldhen Newbie

            Yeah that's right Aslak, I was setting the property lately and actually it was never taken into account , that's why even if I had a JDBCRealm in my login.conf, I was always getting an exception about fileRealm.

            Actually, the problem was that in my domain.xml I defined several <auth-realm> fileRealm, JDBCRealm ... and it seems that it took the first realm that was defined (fileRealm).

            Removing the setting up of the property and all realm in my domain except the JDBCRealm resolved my pbroblem.