2 Replies Latest reply on Mar 7, 2015 4:54 AM by Abhinav Gupta

    Remote EJB call: Authentication failed: the server presented no authentication mechanisms

    miragpl Newbie

      Hi everyone,

       

      I got and issue with invoking remote EJB deployed Wildfly 8.1.0.Final that has been started with "standalone-full-ha.xml" configuration.

      Whenever server is started on another host and I try to invoke a remote EJB from my standalone client i got following exception:

       

       

      lip 10, 2014 1:48:55 PM org.jboss.ejb.client.EJBClient <clinit>
      INFO: JBoss EJB Client version 2.0.1.Final
      lip 10, 2014 1:48:56 PM org.xnio.Xnio <clinit>
      INFO: XNIO version 3.2.2.Final
      lip 10, 2014 1:48:56 PM org.xnio.nio.NioXnio <clinit>
      INFO: XNIO NIO Implementation Version 3.2.2.Final
      lip 10, 2014 1:48:56 PM org.jboss.remoting3.EndpointImpl <clinit>
      INFO: JBoss Remoting version 4.0.3.Final
      lip 10, 2014 1:48:58 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
      INFO: EJBCLIENT000017: Received server version 2 and marshalling strategies [river]
      lip 10, 2014 1:48:58 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
      INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@3907b408, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@28bc9678,channel=jboss.ejb,nodename=TSM_1]} on channel Channel ID c6c2a3d7 (outbound) of Remoting connection 693a2c6a to /172.18.55.73:8080
      lip 10, 2014 1:49:00 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
      INFO: EJBCLIENT000017: Received server version 2 and marshalling strategies [river]
      lip 10, 2014 1:49:00 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
      INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@3907b408, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@6ec6dd79,channel=jboss.ejb,nodename=TSM_2]} on channel Channel ID f42b3ea0 (outbound) of Remoting connection 1615f43d to /172.18.55.74:8080
      lip 10, 2014 1:49:02 PM org.jboss.remoting3.remote.RemoteConnection handleException
      ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
      lip 10, 2014 1:49:02 PM org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager getEJBReceiver
      INFO: Could not create a connection for cluster node ClusterNode{clusterName='ejb', nodeName='TSM_2', clientMappings=[ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='172.18.55.74', destinationPort=8080}], resolvedDestination=[Destination address=172.18.55.74, destination port=8080]} in cluster ejb
      java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
        at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:92)
        at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:77)
        at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51)
        at org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:79)
        at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.call(ClusterContext.java:405)
        at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.call(ClusterContext.java:379)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
      Caused by: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:388)
        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:196)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:110)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
        at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)
        at ...asynchronous invocation...(Unknown Source)
        at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272)
        at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:388)
        at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:153)
        at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:133)
        at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:75)
        ... 8 more
      

       

      Despite the thrown exception the remote EJB call works correctly. The problem occurs only when Wildfly is running on another machine (locally all works fine) and has been started with standalone-full-ha.xml configuration  - even when there is only one node active. When using standalone-full.xml such call works without an exception.

       

      I'm using standard Wildfly (standalone-full-ha.xml) configurations without any changes. I'm attaching simple project that can be used to verify the problem. The run the project do following steps:

       

      0. unpack the test.zip archive

      1. add user to Wildfly (using add-user.sh script)

      2. modify \test\client\src\main\resources\jboss-ejb-client.properties - fill newly added user/pass and provided proper hostname/ip address (remember that problem does not occur when run locally)

      3. execute mvn clean install

      4. copy test\dist\target\dist-0.1.0-SNAPSHOT to JBOSS_HOME/standalone/deployments

      5. start Wildfly ./standalone.sh -c standalone-full-ha.xml -Djboss.node.name=NODE_2 -b xx.x.x.x -Djboss.bind.address.management=xx.x.x.x

      6. execute mvn clean package shade:shade in test/client  (to create executable jar )

      7. run client from command line: java -jar target\client-0.1.0-SNAPSHOT.jar test.test.wildfly.TestClient

       

      Thanks in advance for any hint!

        • 1. Re: Remote EJB call: Authentication failed: the server presented no authentication mechanisms
          Graham Stewart Newbie

          I have just come across this problem as well with exactly the same behaviour.

           

          I was testing remote deployment to a remote wildfly server using as an example the code attached to this article http://www.nailedtothex.org/articles/test/it/ After some trial and error and finally finding the correct configuration settings required for the wildfly-maven-plugin to deploy to a remote server. The test included in the code which tested the connection to EJB failed against the the remote server with

          ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException:

          Authentication failed: the server presented no authentication mechanisms

          Oct 28, 2014 2:52:30 PM org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector setupEJBReceivers

          WARN: Could not register a EJB receiver for connection to glassfish:8080

          java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms

           

          The test code:

          public class HigeTestIT {

           

           

            Context context;

            Hige instance;

           

           

            @Before

            public void before() throws Exception {

            Properties props = new Properties();

           

           

            String port = System.getProperty("wildfly.remote.port");

            if(port != null){

            props.setProperty("remote.connection.default.port", port);

            }

                         

                          String host = System.getProperty("wildfly.remote.hostname");

                          if (host != null)

                          {

                              props.setProperty("remote.connection.default.host", host);

                          }

           

            context = new InitialContext(props);

            instance = (Hige) context.lookup("ejb:/it//HigeImpl!org.nailedtothex.it.Hige");

            }

           

           

            @After

            public void after() throws Exception {

            if (context != null) {

            context.close();

            }

            }

           

           

            @Test

            public void test() {

            System.out.println("***THIS IS A INTEGRATION TEST***");

            assertEquals(6, instance.doHige(2, 3));

            }

           

           

          }

           

           

          This code passes successfully if the connection is to the local host

           

          Running org.nailedtothex.it.HigeTestIT

          Oct 28, 2014 2:10:55 PM org.xnio.Xnio <clinit>

          INFO: XNIO version 3.2.0.Final

          Oct 28, 2014 2:10:55 PM org.xnio.nio.NioXnio <clinit>

          INFO: XNIO NIO Implementation Version 3.2.0.Final

          Oct 28, 2014 2:10:55 PM org.jboss.remoting3.EndpointImpl <clinit>

          INFO: JBoss Remoting version 4.0.0.Final

          Oct 28, 2014 2:10:55 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage

          INFO: EJBCLIENT000017: Received server version 2 and marshalling strategies [river]

          Oct 28, 2014 2:10:56 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate

          INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@65775cce, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@7f6e0c6c,channel=jboss.ejb,nodename=hppavilion]} on channel Channel ID 93e9b03a (outbound) of Remoting connection 053838

          e6 to localhost/127.0.0.1:8080

          Oct 28, 2014 2:10:56 PM org.jboss.ejb.client.EJBClient <clinit>

          INFO: JBoss EJB Client version 2.0.0.Final

          ***THIS IS A INTEGRATION TEST***

          Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.447 sec - in org.nailedtothex.it.HigeTestIT

           

          Passes if it is connected to local host using the hostname ie hppavilion

           

          Running org.nailedtothex.it.HigeTestIT

          Oct 28, 2014 2:38:21 PM org.xnio.Xnio <clinit>

          INFO: XNIO version 3.2.0.Final

          Oct 28, 2014 2:38:21 PM org.xnio.nio.NioXnio <clinit>

          INFO: XNIO NIO Implementation Version 3.2.0.Final

          Oct 28, 2014 2:38:21 PM org.jboss.remoting3.EndpointImpl <clinit>

          INFO: JBoss Remoting version 4.0.0.Final

          Oct 28, 2014 2:38:22 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage

          INFO: EJBCLIENT000017: Received server version 2 and marshalling strategies [river]

          Oct 28, 2014 2:38:22 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate

          INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@11f1c7d0, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@187531e4,channel=jboss.ejb,nodename=hppavilion]} on channel Channel ID ac9f1207 (outbound) of Remoting connection 5505aa49 to hppavilion.grahamstewart.local/10.0.0.8:8080

          Oct 28, 2014 2:38:22 PM org.jboss.ejb.client.EJBClient <clinit>

          INFO: JBoss EJB Client version 2.0.0.Final

          ***THIS IS A INTEGRATION TEST***

          Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.496 sec - in org.nailedtothex.it.HigeTestIT

           

          However as soon as the connection is attempted to another machine on the network running the same version of wildfly 8.1.0.Final authentication is requested.

           

          Running org.nailedtothex.it.HigeTestIT

          Oct 28, 2014 2:52:30 PM org.xnio.Xnio <clinit>

          INFO: XNIO version 3.2.0.Final

          Oct 28, 2014 2:52:30 PM org.xnio.nio.NioXnio <clinit>

          INFO: XNIO NIO Implementation Version 3.2.0.Final

          Oct 28, 2014 2:52:30 PM org.jboss.remoting3.EndpointImpl <clinit>

          INFO: JBoss Remoting version 4.0.0.Final

          Oct 28, 2014 2:52:30 PM org.jboss.remoting3.remote.RemoteConnection handleException

          ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException:

          Authentication failed: the server presented no authentication mechanisms

          Oct 28, 2014 2:52:30 PM org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector setupEJBReceivers

           

          Note: the only thing being changed between the above examples was the wildfly.remote.hostname property value in the pom to point to localhost, hppavilion (local) and glassfish (remote) where running servers were located.

           

          Deployment in all cases is successful.

           

          Why is there a difference between the two ?. Authentication should be required for both use cases, local and remote servers otherwise testing code against local instance of wildfly is not going to be the same as testing against a remote instance.

           

          Graham

          • 2. Re: Remote EJB call: Authentication failed: the server presented no authentication mechanisms
            Abhinav Gupta Newbie

            Did you get any solution for this. I am facing exactly same issue , with domain with full-ha profile.

            I have two nodes on different hosts , cluster is created sucessfully . But when I invoke EJB from remote client , I am getting

            Mar 07, 2015 3:21:20 PM org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager getEJBReceiver

            INFO: Could not create a connection for cluster node ClusterNode{clusterName='ejb', nodeName='slave:server-one', clientMappings=[ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='130.21.185.205', destinationPort=8080}], resolvedDestination=[Destination address=130.21.185.205, destination port=8080]} in cluster ejb

            java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms

                at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:92)

                at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:77)

                at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51)

                at org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:79)

                at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.call(ClusterContext.java:405)

                at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.call(ClusterContext.java:379)

                at java.util.concurrent.FutureTask.run(FutureTask.java:262)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                at java.lang.Thread.run(Thread.java:744)

            Caused by: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms

                at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:388)3

             

             

            PS : If I bring down my slave , then EJB connection is success.