1 Reply Latest reply on Oct 2, 2013 5:39 AM by Sumeet J

    javax.security.sasl.SaslException  when trying to connect to JBoss 7 server from java client

    Sumeet J Newbie

       

       

       

       

      My java client ( run from within eclipse ) now gives me the following SASL error when i make an attempt to connect to an external server . When the server is local then the executions is OK .

      - JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed - Could not register a EJB receiver for connection to remote://10.160.148.61:4447 java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed

      I have tried to follow the steps mentioned EJB invocations from a remote client using JNDI - JBoss AS 7.1 - Project Documentation Editor

       

      The exception tells me there is something wrong in my configuration files related to authentication . Here is my ejb_client_properties file

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false 

      remote.connections=default

      remote.connection.default.host=10.160.148.61

      remote.connection.default.port = 4447

      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

      remote.connection.default.username=tan

      remote.connection.default.password=f2b1c3c7d3f1e224cbf6508494cf0418

      Note : the user tan is added to my mgt.user.properties file on the server . I used add-user.bat to add a user in the server . I also added an application user . I use the same credentials to pass to the server .I tried both mgmt user & application users.

      I cant think of anything else .

      My ejb calling is as follows :

         final Hashtable jndiProperties = new Hashtable();

        jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

         InitialContext aJNDI = new InitialContext(jndiProperties);

        Ppi handle = (Ppi) aJNDI .lookup("ejb:PPIEAR/PService/PConnect!com.gem.p.PConnection?stateful");

       

      I see numerous threads related to the exception but unable to fix it Can someone help .

       

      I also have a legitimate SSL certificate installed on the server . Do i need to do something extra to take care of that ?

        • 1. Re: javax.security.sasl.SaslException  when trying to connect to JBoss 7 server from java client
          Sumeet J Newbie

          Ok I have been able to figure out the problem .

           

          It was a case of the the application user being added incorrectly on the server side . Specifically see below .

           

          [userone@localhost bin]$ ./add-user.sh

           

          What type of user do you wish to add?

          a) Management User (mgmt-users.properties)

          b) Application User (application-users.properties)

          (a): b

           

          Enter the details of the new user to add.

          Realm (ApplicationRealm) :  ApplicationRealm ---->> Careful Here . You need to type this or leave it blank . I filled an incorrect value here and things went wrong from there .

          Username : testuser

          Password : testpassword

          Re-enter Password : testpassword

           

          What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none) : testrole

          About to add user 'testuser' for realm 'ApplicationRealm'

           

          Is this correct yes/no? yes

           

          Added user 'testuser' to file '/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-users.properties'

          Added user 'testuser' to file '/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-users.properties'

          Added user 'testuser' with roles testrole to file '/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-roles.properties'

          Added user 'testuser' with roles testrole to file '/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-roles.properties'

          .

          .

          I took me a long time to figure this out . Helpful link for the same :: http://middlewaremagic.com/jboss/?p=1466