我无法从我的 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
是文件夹中的 p12 文件resources
,包含公共证书和私钥对
这让我很困惑,我在这个问题上浪费了一整天,仍然没有解决方案。我知道,一旦我声明我的主机通过传递 url 使用 SSL,因为ssl://some-ip-address:port
连接工厂将尝试查找 CA。问题是我不知道在哪里指定我正在使用的 CA。