WebSphere AdminClient 连接到本地托管进程而不是属性中指定的 HOST:PORT

WebSphere AdminClient connects to local managed process instead of HOST:PORT specified in properties

我遇到过使用 RMI 连接器的 WebSphere AdminClient 的奇怪行为。

在 WAS 7 独立服务器(服务器名称:server1)上部署了一个测试 Web 应用程序(一个 servlet),端口范围为 20000-20050。 servlet 应该打开一个 AdminClient 到 WAS 6.1 独立服务器(服务器名称:server1),端口范围 20200-20250 使用 RMI 连接器:

Properties props = new Properties();
props.setProperty(AdminClient.CONNECTOR_HOST, "localhost");
props.setProperty(AdminClient.CONNECTOR_PORT, "20209"); // ORB, BOOTSTRAP is 20204, both behave the same
props.setProperty(AdminClient.CONNECTOR_TYPE,     AdminClient.CONNECTOR_TYPE_RMI);
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
props.setProperty(AdminClient.CONNECTOR_AUTO_ACCEPT_SIGNER, "true");
props.setProperty(AdminClient.USERNAME, "someuser");
props.setProperty(AdminClient.PASSWORD, "somepassword");

AdminClient ac = AdminClientFactory.createAdminClient(props);

// locate and stop server1 
Set servers = ac.queryNames(new ObjectName("WebSphere:type=Server,name=server1,*"), null);
if(!servers.isEmpty()) {
    ObjectName server = (ObjectName) servers.iterator().next();
    if(server != null) {
        ac.invoke( server, "stop", null, null );
    }
} 

现在的问题是这样的 AdminClient 连接到本地(WAS 7,端口范围 20000-20050)进程并停止它(因为它具有相同的服务器名称:server1)。

HOST 和 PORT 属性似乎被忽略了,但是 SECURITY_ENABLED,使用了 USERNAME 和 PASSWORD(用错误的用户名/密码测试)。知道为什么它不连接到其他服务器吗?我责怪某些本地属性文件优先于指定的属性,但没有找到任何东西(sas.client.props 不包含任何 host/port 信息)。使用 SOAP 连接器,它工作得很好。

更新 当两台服务器在不同的机器上,所以HOST属性是不同的,它真的连接在那里。用户仍然必须存在于同一领域内的两台机器上。所以问题是当两个完全独立的进程(一个托管客户端应用程序和一个要连接的进程)驻留在同一台主机上时,然后它连接到本地进程 - PORT 属性 指向另一个进程被忽略.

我怀疑您需要知识中心 Application access problems 主题的 "Two servers with the same name running on the same host are being used to interoperate" 部分中描述的 com.ibm.websphere.orb.uniqueServerName 属性。