Search code examples
javaipejbweblogiccluster-computing

How to find the IP address of the Server inside the EJB


I have deployed EJB application in weblogic cluster which consist of 2 managed servers. I need to track witch physical server is processing the each and every request from the remote client. So I need to print server Ip inside EJB method. Please advice me.


Solution

  • This can help you:

    System.out.println("Server-IP:" +  java.net.InetAddress.getLocalHost().getHostAddress());
    System.out.println("Host:" + java.net.InetAddress.getLocalHost());