创建多个websphere连接出现异常?

发布于 2021-11-20 10:25:13 字数 5212 浏览 941 评论 10

我的代码如下:

 

public class TestConn {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	    test221();
		test129();
	}
	
	public static void test221(){
		Properties connectProps = new Properties();
		connectProps.setProperty(AdminClient.CONNECTOR_TYPE,
				AdminClient.CONNECTOR_TYPE_SOAP);
		connectProps.setProperty(AdminClient.CONNECTOR_HOST, "192.168.1.221");
		connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8880");
		connectProps.setProperty(AdminClient.USERNAME, "root");
		connectProps.setProperty(AdminClient.PASSWORD, "sino");
		connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
		connectProps.setProperty("javax.net.ssl.trustStore","e:/webSphere/test_1/trust.jks");
		connectProps.setProperty("javax.net.ssl.keyStore", "e:/webSphere/test_1/store.jks");
		connectProps.setProperty("javax.net.ssl.trustStorePassword", "oracle");
		connectProps.setProperty("javax.net.ssl.keyStorePassword", "oracle");
		
		try {
			AdminClient adminClient = AdminClientFactory
					.createAdminClient(connectProps);
			System.out.println(adminClient);
		} catch (ConnectorException e) {
			e.printStackTrace();
		}
	}
	
	public static void test129(){
		Properties connectProps = new Properties();
		connectProps.setProperty(AdminClient.CONNECTOR_TYPE,
				AdminClient.CONNECTOR_TYPE_SOAP);
		connectProps.setProperty(AdminClient.CONNECTOR_HOST, "192.168.1.129");
		connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8881");
		connectProps.setProperty(AdminClient.USERNAME, "root");
		connectProps.setProperty(AdminClient.PASSWORD, "admin");
		connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
		connectProps.setProperty("javax.net.ssl.trustStore", "e:/webSphere/test/trust.jks");
		connectProps.setProperty("javax.net.ssl.keyStore", "e:/webSphere/test/store.jks");
		connectProps.setProperty("javax.net.ssl.trustStorePassword", "jks");
		connectProps.setProperty("javax.net.ssl.keyStorePassword", "jks");
		
		try {
			AdminClient adminClient = AdminClientFactory
					.createAdminClient(connectProps);
			System.out.println(adminClient);
		} catch (ConnectorException e) {
			e.printStackTrace();
		}
	}

}

运行结果如下:

 

com.ibm.ws.management.AdminClientImpl@d42d08
2012-8-17 16:24:02 com.ibm.websphere.management.AdminClientFactory
警告: ADMC0046W
com.ibm.websphere.management.exception.ConnectorException: ADMC0053E: 启用 SOAP 连接器安全性时,系统无法创建连接到端口 8881 上的主机 192.168.1.129 的 SOAP 连接器。
	at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:476)
	at TestConn.test129(TestConn.java:56)
	at TestConn.main(TestConn.java:14)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:331)
	... 2 more
Caused by: com.ibm.websphere.management.exception.ConnectorNotAvailableException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; targetException=java.lang.IllegalArgumentException: Error opening socket: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
	at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:338)
	at com.ibm.ws.management.connector.soap.SOAPConnectorClient.<init>(SOAPConnectorClient.java:175)
	... 7 more
Caused by: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; targetException=java.lang.IllegalArgumentException: Error opening socket: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
	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)
	... 8 more

请问为什么第二个连接不能创建成功呢?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

做个少女永远怀春 2021-11-25 05:34:26

急求高手指点,谢谢。

屌丝范 2021-11-25 05:34:18

同求

心舞飞扬 2021-11-25 05:32:43

同求解决方案

回眸一笑 2021-11-25 05:32:27

记得当时我没有解决这问题,我也只是能创建一个连接

归途 2021-11-25 05:31:42

你好,不知道这个问题,你当时是怎么解决的

蓝颜夕 2021-11-25 05:03:11

我有正确引用了证书的路径,但异常不知道为什么还是说证书错误

贱贱哒 2021-11-25 04:54:24

无法找到合法的证书

嘦怹 2021-11-25 00:42:36

虽然打印异常出来,但问题没有解决,不知道在同一文件中创建两个连接是不是根本就是错误的

半世蒼涼 2021-11-24 23:36:04

回复
启用 SOAP 连接器安全性时,系统无法创建连接到端口 8881 上的主机 192.168.1.129 的 SOAP 连接器。 问题应该在这

南汐寒笙箫 2021-11-24 22:41:18

异常不都打出来了么。。。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文