gpt4 book ai didi

java - 为java创建WebSphere管理客户端程序

转载 作者:行者123 更新时间:2023-12-01 04:47:52 25 4
gpt4 key购买 nike

我正在使用 IBM WebSphere 服务器。我需要使用WebSphere 管理API 创建用于java 的WebSphere 管理客户端程序。我正在使用this code用于创建管理客户端

...
adminClient = AdminClientFactory.createAdminClient(connectProps);
...

但它给出了异常(exception)。

系统无法创建 SOAP 连接器来连接到端口 8881 上的主机 localhost。

创建客户端后,我想通过此 API 配置 WASADMIN。我走在正确的道路上吗?

我需要通过这个API获取共享库。

最佳答案

检查您是否将此服务器 SOAP 连接器端口设置为 8881。

在 Dmgr 中单击服务器名称而不是端口进行检查。如果不使用 8881,请将其更改为您尝试连接的服务器所使用的正确端口。

更新:

我在我的环境(Linux)中进行了测试,并且以下代码有效(我必须将 WebSphere_ND8.5/AppServer/runtimes/com.ibm.ws.admin.client_8.5.0.jar 添加到类路径中才能运行它,而不会得到ClassNotFoundException):

import java.util.Properties;
import java.util.logging.Logger;

import com.ibm.websphere.management.AdminClient;
import com.ibm.websphere.management.AdminClientFactory;
import com.ibm.websphere.management.exception.ConnectorException;

public class AdminConnect {

private static Logger logger = Logger.getLogger(AdminConnect.class.getName());
/**
* @param args
*/
public static void main(String[] args) {
Properties connectProps = new Properties();
connectProps.setProperty(
AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);

connectProps.setProperty(AdminClient.CONNECTOR_HOST, "localhost");
connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8880");
// connectProps.setProperty(AdminClient.USERNAME, "test2");
// connectProps.setProperty(AdminClient.PASSWORD, "user24test");
AdminClient adminClient = null;
try
{
adminClient = AdminClientFactory.createAdminClient(connectProps);
logger.info("Connected successfuly with WebSphere :) ");
}
catch (ConnectorException e)
{
logger.severe("Exception creating admin client: " + e);
e.printStackTrace();
}

}

}

关于java - 为java创建WebSphere管理客户端程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15522137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com