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

藍色的海 发布于 2012/08/16 16:24
阅读 1K+
收藏 0

我的代码如下:

 

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

请问为什么第二个连接不能创建成功呢?
加载中
0
黑狗
黑狗
异常不都打出来了么。。。
黑狗
黑狗
回复 @じ☆veィ尔惢 : 启用 SOAP 连接器安全性时,系统无法创建连接到端口 8881 上的主机 192.168.1.129 的 SOAP 连接器。 问题应该在这
藍色的海
藍色的海
虽然打印异常出来,但问题没有解决,不知道在同一文件中创建两个连接是不是根本就是错误的
0
杰克肖
杰克肖
无法找到合法的证书
藍色的海
藍色的海
我有正确引用了证书的路径,但异常不知道为什么还是说证书错误
0
walker30
walker30
你好,不知道这个问题,你当时是怎么解决的
藍色的海
藍色的海
记得当时我没有解决这问题,我也只是能创建一个连接
0
betrue
betrue
同求解决方案
a
alex1017
同求
0
强尼李
强尼李
急求高手指点,谢谢。
返回顶部
顶部