Invoking remote ejb in a 2-node wildfly cluster
<p>I am trying to invoke remote ejb on each node of a cluster with nodes node1 &amp; node2, but i am always getting node1. Deployed EJB &amp; client code as EAR file in both nodes. Application is running on Wildfly 9 ApplicationServer. Invoked client code from node1.</p>

<p><strong>EJB code</strong>:</p>

<pre><code>@Remote
public interface SLSBRemote {
    public void test();
}

@Stateless(mappedName="SLSBEJB")
public class SLSBEJB implements SLSBRemote {
    @Override
    public void test() 
    {
       try {
          String nodeName = System.getProperty("jboss.node.name");
          if(nodeName == null) {
             nodeName = InetAddress.getLocalHost().getHostName();
          }
          log.debug("nodename: "+nodeName);
       } catch (Exception e) {
          log.error("Error",e);
       }
    }
}
</code></pre>

<p><strong>client code:</strong></p>

<pre><code>public class testEjb
{
    //invoking this method from other class. Able to pass node address
    public void testBean(List&lt;String&gt; nodes)
    {
       Properties properties = new Properties();
       properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
       Context context;
       for (String node : nodes) {
           properties.put(Context.PROVIDER_URL,"http-remoting://" + node);
           try {
             context = new InitialContext(properties);                  
             SLSBRemote slsbRemote=(SLSBRemote)context.lookup(getLookupName());
             log.debug("node:"+node+"slsbejbobject:"+slsbRemote.hashCode());
             slsbRemote.test();
           } catch (NamingException e) {
             log.error("Error ", e);
           }
       }
   }
}
</code></pre>

<p>In the logs,</p>

<pre><code>node: "node1", binddbejb object: 1276422461
node: "node2", binddbejb object: 1276422461
nodename: "node1_address"
nodename: "node1_address" (instead of node2_address)
</code></pre>

<p>Please suggest</p>