3 Replies Latest reply on Feb 27, 2018 4:08 PM by mostafa342

    javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms in Wildfly 10.1

    mostafa342

      Hi there,

       

      I am new to EJBs, and I am trying to perform remote invocations on stateless and stateful beans that I have deployed on a pod in my project that is based on Wildfly 10.1 in the new OpenShift 3 (Origin). The code that I am using for initializing the client context looks like:

       

      Propoeties clientProperties = new Properties();

      clientProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");

      clientProperties.put("remote.connections", "default");

      clientProperties.put("remote.connection.default.host", "localhost");

      clientProperties.put("remote.connection.default.port", "8080");

      clientProperties.put("remote.connection.default.username", "****");

      clientProperties.put("remote.connection.default.password", "****");

      clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

      clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

       

      EJBClientContext.setSelector(new ConfigBasedEJBClientContextSelector(new PropertiesBasedEJBClientConfiguration(clientProperties)));

       

      Properties contextProperties = new Properties();

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

      contextProperties.put(Context.SECURITY_PRINCIPAL, "****"); //username

      contextProperties.put(Context.SECURITY_CREDENTIALS, "****"); //password

       

      Context context = new InitialContext(contextProperties);

       

      String appName = "CloudEAR";

      String moduleName = "CloudEjb";

      String distinctName = "";

      String beanName = "Calculator";

      String qualifiedRemoteView = "cloudEJB.view.CalculatorRemote";

      String lookupString = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + qualifiedRemoteView;

       

      Calculator calculator = (CalculatorRemote) context.lookup(lookupString);

      int sum = calculator.sum(10, 10);

       

      And the error message that I get is:

       

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

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

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

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

      at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

      at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:198)

      at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:112)

      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:89)

      at org.xnio.nio.WorkerThread.run(WorkerThread.java:567)

      at ...asynchronous invocation...(Unknown Source)

      at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272)

      at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:388)

       

      Initially I tried using the "jboss-ejb-client.properties" file, but that wasn't even able to make the remote connection. Now I am manually creating and configuring the EJBClientContext, and at least is successfully connecting to the remote server, but the invocation filas because of authentication failures. I remember that we used to solve this issue by removing the "security realm" argument in "standalone.xml" files in older versions of OpenShift; however I am not able to find that file in the new version anymore. I have been looking at concepts such as secrets, volumes etc. but I really don't have a clear understanding how this works. When I create a new secret and try to associate it with my pod, the new deployment procedure fails. I would really appreciate any help.