如何获取F5负载均衡中某台Was服务器的IP和端口号
public static String getServerPort() {String port = "9999";//默认端口号
try {
//获取Weblogic端口号
Context myCtx = new InitialContext();
MBeanServer tMBeanServer = (MBeanServer) myCtx.lookup("java:comp/env/jmx/runtime");
ObjectName tObjectName = new ObjectName("com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");
ObjectName serverrt = (ObjectName) tMBeanServer.getAttribute(tObjectName, "ServerRuntime");
port = String.valueOf(tMBeanServer.getAttribute(serverrt, "ListenPort"));
} catch (Exception e) {
e.printStackTrace();
}
return port;
}
上述代码片断是针对Weblogic服务器获取Ip和端口号的,有没有类似获取WebSphere服务器的程序
补充:Java , Web 开发