JMX开发报com.ibm.jsse2.util.h: No trusted certificate found错误

java1109 2013-05-03 10:24:10
代码如下:
package com.test;

import java.util.Properties;

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

public class WasJmxAdminClientTest {

/**
* @param args
*/
public static void main(String[] args) {

System.setProperty("javax.net.debug", "ssl,handshake");

String host = "localhost";
String port = "8880";
String username = "was";
String wasPassword = "was";

Properties adminProps = new Properties();
adminProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
adminProps.setProperty(AdminClient.CONNECTOR_HOST, host);
adminProps.setProperty(AdminClient.CONNECTOR_PORT, port);

adminProps.setProperty(AdminClient.USERNAME, username);
adminProps.setProperty(AdminClient.PASSWORD, wasPassword);

// WebSphere服务器是否已启用管理安全性
adminProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
adminProps.setProperty(AdminClient.CONNECTOR_AUTO_ACCEPT_SIGNER, "true");

String keyStoreType = "JKS" ;
String keystorePath = "F:/wasMoni/test/DummyClientKeyFile.jks" ;
String truststorePath = "F:/wasMoni/test/DummyClientTrustFile.jks" ;
String password = "WebAS" ;
String trustpassword = "WebAS" ;

adminProps.setProperty("javax.net.ssl.keyStoreType", keyStoreType);
adminProps.setProperty("javax.net.ssl.trustStore", truststorePath);
adminProps.setProperty("javax.net.ssl.keyStore", keystorePath);
adminProps.setProperty("javax.net.ssl.trustStorePassword", password);
adminProps.setProperty("javax.net.ssl.keyStorePassword", trustpassword);


AdminClient adminClient;
try {
adminClient = AdminClientFactory.createAdminClient(adminProps);

} catch (Exception e) {
System.out.println("getAdminClient: exception");
new AdminException(e).printStackTrace();
}

}

}

报错信息如下:
com.ibm.websphere.management.exception.AdminException: com.ibm.websphere.management.exception.ConnectorException: ADMC0053E: 启用 SOAP 连接器安全性时,系统无法创建连接到端口 8880 上的主机 localhost 的 SOAP 连接器。
at com.test.WasJmxAdminClientTest.main(WasJmxAdminClientTest.java:107)
Caused by: com.ibm.websphere.management.exception.ConnectorException: ADMC0053E: 启用 SOAP 连接器安全性时,系统无法创建连接到端口 8880 上的主机 localhost 的 SOAP 连接器。
at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:476)
at com.test.WasJmxAdminClientTest.main(WasJmxAdminClientTest.java:101)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:331)
... 1 more
Caused by: com.ibm.websphere.management.exception.ConnectorNotAvailableException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: No trusted certificate found; targetException=java.lang.IllegalArgumentException: Error opening socket: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: No trusted certificate found]
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:338)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.<init>(SOAPConnectorClient.java:175)
... 6 more
Caused by: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: No trusted certificate found; targetException=java.lang.IllegalArgumentException: Error opening socket: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: No trusted certificate found]
at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
at org.apache.soap.rpc.Call.invoke(Unknown Source)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient$4.run(SOAPConnectorClient.java:303)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:296)
... 7 more
...全文
425 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
java1109 2013-05-06
原来是IBM的jdk包有问题。。
回复
相关推荐
发帖
WebSphere
创建于2007-08-27

2608

社区成员

WebSphere 是 IBM 的软件平台。它包含了编写、运行和监视全天候的工业强度的随需应变 Web 应用程序和跨平台、跨产品解决方案所需要的整个中间件基础设施,如服务器、服务和工具。
申请成为版主
帖子事件
创建了帖子
2013-05-03 10:24
社区公告
暂无公告