简体   繁体   中英

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.

We had somewhat similar requirement in our project. We wanted to print the Managed Server Instance Name in logs which has processed the JMS message. We did it in following way -

System.getProperty("weblogic.Name");

This can help you:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM