3 Replies Latest reply on Mar 31, 2014 1:11 PM by wdfink

    Unable to do a simple remote EJB lookup.

    blakecmartin

      I'm trying to look up an EJB on a remote server from a Java application on my local machine. I've set up an application user in WildFly 8.0.0 and am running in standalone-full mode. The EJB deployed successfully.

       

      When I try to look up the EJB using the following code (which I'm sure is wrong due to the JNDI name), I get the following error:

      • ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms

       

      Any idea as to what the problem could be?

       

      Thanks,

      Blake

       

          String host = "172.16.18.39";
          Properties clientProperties = new Properties();
          clientProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");  
          clientProperties.put(Context.PROVIDER_URL, "http-remoting://" + host + ":8080");
          clientProperties.put(Context.SECURITY_PRINCIPAL, "abc");
          clientProperties.put(Context.SECURITY_CREDENTIALS, "123");   
          clientProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
        
          clientProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
          clientProperties.put("remote.connections", "default");
          clientProperties.put("remote.connection.default.port", 8080);
          clientProperties.put("remote.connection.default.host", host);
          clientProperties.put("remote.connection.default.username", "abc");
          clientProperties.put("remote.connection.default.password", "123");
          clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

       

          EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(clientProperties);
          ContextSelector<EJBClientContext> contextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
          EJBClientContext.setSelector(contextSelector);

       

          Context context = new InitialContext(clientProperties);
          context.lookup("java:global/ejb-ear-1.0/an-ejb-1.0/SomeEjb!com.xyz.ejb.SomeEjbRemote");
        • 1. Re: Unable to do a simple remote EJB lookup.
          wdfink

          I suppose the JNDI name should be "ejb:ejb-ear-1.0/an-ejb-1.0/SomeEjb!com.xyz.ejb.SomeEjbRemote"

          Also the properties are a mix of remote-naming and ejb-client, this mix will have unexpected results.

           

          Please look to the ejb-remote example and documentation EJB invocations from a remote client using JNDI

          • 2. Re: Unable to do a simple remote EJB lookup.
            blakecmartin

            Thank you for letting me know the proper JNDI name (and that the prefix has changed to "ejb:"). I made those changes.

             

            Now I'm getting that error plus a new one:

             

            • WARN: Could not register a EJB receiver for connection to 172.16.18.39:8080
            • ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
            • Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:ejb-ear-1.0, moduleName:an-ejb-1.0, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@aee25db

             

            I based the JNDI name on the URI I found in the server log. I'm attempting to look up this: "ejb:ejb-ear-1.0/an-ejb-1.0/SomeEjb!" + SomeEjbRemote.class.getName()

            • 3. Re: Unable to do a simple remote EJB lookup.
              wdfink

              Did you remove the security-realm from the connector?

               

              Maybe you should have a look to the ejb-remote quickstart which might give you hints