Problem with JNDI lookup from all the nodes in wildfly-16.0.0.Final cluster
shailendra_kumar1 Aug 7, 2019 8:26 AMWe are using wildfly-16.0.0.Final.
we are trying to migrate the project from weblogic to wildfly16.
wildfly domain is running in cluster domain mode with one server on master and one server on slave.
"user" created on both nodes i.e. master and slave. the jndi binding for object is like "java:jboss/exported/VFOSTYLESTARTUP".
we are trying to get the JNDI object from both nodes(servers) in order to make the RMI call on both nodes.
we are observing the IP in both objects are same i.e. the server ip which is processing the request.
we have replaced weblogic t3 protocol to http-remoting.
please help on this.
public ArrayList getJNDIObjects() throws Exception {
ArrayList arrList = null;
try{
ArrayList runningservers = new ArrayList();
runningservers.add("http-remoting://IP1:PORT");
runningservers.add("http-remoting://IP2:PORT");
final Properties env = new Properties();
Iterator itr = runningservers.iterator();
while (itr.hasNext())
{
String url = (String)itr.next();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.wildfly.naming.client.WildFlyInitialContextFactory");
env.put("java.naming.factory.url.pkgs", "org.jboss.ejb.client.naming");
env.put("jboss.naming.client.ejb.context", true);
env.put(Context.PROVIDER_URL, url);
env.put(Context.SECURITY_PRINCIPAL, "user");
env.put(Context.SECURITY_CREDENTIALS, "password");
Context ctx = new InitialContext(env);
Object obj = (Object) ctx.lookup("VFOSTYLESTARTUP");
if (arrList == null)
{
arrList = new ArrayList();
}
arrList.add(obj);
}
}catch(Exception e){
System.out.println(e);
}
return arrList;
}
lookup done -->VfoStyleStartUp[UnicastServerRef [liveRef: [endpoint:[IP1:53525](local),objID:[-4cf64acc:16c6beacde5:-7fff, 5041751351370329634]]]]
lookup done -->VfoStyleStartUp[UnicastServerRef [liveRef: [endpoint:[IP1:53525](local),objID:[-4cf64acc:16c6beacde5:-7ffe, -5156556789634438493]]]]