我无法从Java应用程序连接到SonicMQ代理。
这是我的客户代码:
System.out.println("Connection setup started");
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStore", keyStoreFile.getAbsolutePath());
System.setProperty("javax.net.ssl.keyStorePassword","changeit");
ConnectionFactory connectionFactory = new progress.message.jclient.ConnectionFactory(args[0]);
Connection connection = connectionFactory.createConnection(args[1], args[2]);
在最后一行我得到"没有指定可信的CA证书。"通知和
javax.jms.JMSException: Unable to register trusted CA certificate(s) or trust decider to verify the broker certificate
at progress.message.jimpl.JMSExceptionUtil.createJMSException(JMSExceptionUtil.java:42)
at progress.message.jimpl.Connection.<init>(Connection.java:755)
at progress.message.jclient.ConnectionFactory.createConnection(ConnectionFactory.java:2055)
at hr.aduro.translatorclient.TranslatorClient.main(TranslatorClient.java:80)
Caused by: [4020] progress.message.net.ESocketConfigException: Unable to register trusted CA certificate(s) or trust decider to verify the broker certificate
at progress.message.net.ssl.ProgressSslSocket.<init>(ProgressSslSocket.java:89)
at progress.message.net.ssl.ProgressSslSocket.<init>(ProgressSslSocket.java:163)
at progress.message.net.ssl.ProgressSslSocketFactory.createProgressSocket(ProgressSslSocketFactory.java:240)
at progress.message.net.ProgressSocketFactory.createProgressSocket(ProgressSocketFactory.java:179)
at progress.message.zclient.Connection.openSocket(Connection.java:3640)
at progress.message.zclient.Connection.connectWithRecoveryOpt(Connection.java:752)
at progress.message.zclient.ReconnectHelper.connectAndChaseSingleFailoverRedirect(ReconnectHelper.java:534)
at progress.message.zclient.Connection.connect(Connection.java:1503)
at progress.message.jimpl.Connection.<init>(Connection.java:536)
... 2 more
注意: keyStoreFile
是resources
文件夹中的p12文件,包含公共证书和私钥对
这让我很困惑,我在这个问题上失去了一整天,仍然没有决心。我知道,只要我通过将网址传递为ssl://some-ip-address:port
来声明我的主机使用SSL,连接工厂就会尝试查找CA.问题是我不知道在哪里指定我正在使用的CA.