受管服务器是远程计算机。给定托管服务器主机名或IP,如何识别其管理服务器。
答案 0 :(得分:0)
您可以使用WLST。
>cd %ORACLE_HOME%\oracle_common\common\bin
>wlst
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline> connect('weblogic', 'dev_password', 't3://dev_host:7011')
Connecting to t3://dev_host:7011 with userid weblogic ...
Successfully connected to managed Server 'soa_server1' that belongs to domain 'dev_domain'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
wls:/dev_domain/serverConfig> serverRuntime()
Location changed to serverRuntime tree. This is a read-only tree with ServerRuntimeMBean as the root.
For more help, use help(serverRuntime)
wls:/dev_domain/serverRuntime> print cmo.adminServerHost
dev_host
wls:/dev_domain/serverRuntime> print cmo.adminServerListenPort
7001
wls:/dev_domain/serverRuntime>
dev_host:7011是托管服务器,dev_host:7001是管理服务器。
答案 1 :(得分:0)
此外,您可以使用纯Java代码,JMX,after - connecting向托管服务器查找,如:
String serverName = System.getProperty("weblogic.Name");
ObjectName serverRuntime = new ObjectName("com.bea:Name=" + serverName + ",Type=ServerRuntime");
Object adminHostName = server.getAttribute( serverRuntime, "AdminServerHost" );
Object adminPort = server.getAttribute( serverRuntime, "AdminServerListenPort" );
response.getWriter().write("Admin server host and port " + adminHostName + ":" + adminPort );