如何从weblogic管理服务器的托管服务器中识别weblogic管理服务器?

如何从weblogic管理服务器的托管服务器中识别weblogic管理服务器?,weblogic,weblogic11g,weblogic12c,Weblogic,Weblogic11g,Weblogic12c,托管服务器是远程计算机。给定托管服务器主机名或ip,如何识别其管理服务器。您可以使用它 >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

托管服务器是远程计算机。给定托管服务器主机名或ip,如何识别其管理服务器。

您可以使用它

>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是管理服务器。

此外,您可以使用纯java代码JMX查找托管服务器,如:

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 );