简体   繁体   中英

Connect to Tibco EMS using SSL java client

We are trying to connect to Tibco EMS using SSL (Java Client) with the following code

factory = new com.tibco.tibjms.TibjmsConnectionFactory(serverUrl);
connection = factory.createConnection(userName,password);

I receive this error:

Failed to connect via SSL to [ssl://host:8132]: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

How to specify certification path to requested target? I have C# client code with EMSSSL.SetTargetHostName("UAT_5653") but in java JMS dont know how to set

com.tibco.tibjms.TibjmsSSL.setExpectedHostName(ssl_hostname);
com.tibco.tibjms.TibjmsSSL.setIdentity(ssl_identity,ssl_key,ssl_password);
com.tibco.tibjms.TibjmsSSL.setVerifyHostName(false);
com.tibco.tibjms.TibjmsSSL.addTrustedCerts(cert);

These parameters can be set in the factory object like:

TibjmsConnectionFactory factory = new com.tibco.tibjms.TibjmsConnectionFactory(serverUrl);
factory.setSSLExpectedHostName(ssl_expected_hostname);
factory.setSSLIdentity(ssl_identity,ssl_key,ssl_password);
factory.setSSLEnableVerifyHostName(false);
factory.setSSLTrustedCertificate(cert);
Connection connection = factory.createConnection(userName,password);

For more information you might take a look at the docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM