AdminClient Websphere NoClassDefFoundError
AdminClient Websphere NoClassDefFoundError
我正在尝试从 Websphere Application Server 连接到远程 Websphere 部署管理器。为此,我正在使用 Websphere AdminClient,但是当我尝试 运行 此代码时,我不断收到错误 java.lang.NoClassDefFoundError: com/ibm/websphere/management/AdminClientFactory:
props = new Properties();
props.setProperty(AdminClient.CONNECTOR_HOST, hostname);
props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
props.setProperty(AdminClient.CONNECTOR_PORT, "8880");
props.setProperty(AdminClient.USERNAME, "<username>");
props.setProperty(AdminClient.PASSWORD, "<password>");
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
try {
adminClient = AdminClientFactory.createAdminClient(props);
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("Something went wrong");
e.printStackTrace();
}
我已将 com.ibm.ws.admin.client_8.5.0.jar 添加到项目中。
这里还有我一开始的导入
import java.util.Properties;
import com.ibm.websphere.management.*;
import com.ibm.websphere.management.exception.ConnectorException;
有谁知道我做错了什么吗?
看来我自己解决了这个问题。
如果有人遇到类似问题,请将 com.ibm.ws.admin.client_x.x.x.jar 添加到文件夹 WEB-INF/lib
我正在尝试从 Websphere Application Server 连接到远程 Websphere 部署管理器。为此,我正在使用 Websphere AdminClient,但是当我尝试 运行 此代码时,我不断收到错误 java.lang.NoClassDefFoundError: com/ibm/websphere/management/AdminClientFactory:
props = new Properties();
props.setProperty(AdminClient.CONNECTOR_HOST, hostname);
props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
props.setProperty(AdminClient.CONNECTOR_PORT, "8880");
props.setProperty(AdminClient.USERNAME, "<username>");
props.setProperty(AdminClient.PASSWORD, "<password>");
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
try {
adminClient = AdminClientFactory.createAdminClient(props);
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("Something went wrong");
e.printStackTrace();
}
我已将 com.ibm.ws.admin.client_8.5.0.jar 添加到项目中。
这里还有我一开始的导入
import java.util.Properties;
import com.ibm.websphere.management.*;
import com.ibm.websphere.management.exception.ConnectorException;
有谁知道我做错了什么吗?
看来我自己解决了这个问题。 如果有人遇到类似问题,请将 com.ibm.ws.admin.client_x.x.x.jar 添加到文件夹 WEB-INF/lib