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

我的代码如下:

 

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

请问为什么第二个连接不能创建成功呢?
举报
藍色的海
发帖于5年前 5回/1K+阅
顶部