【问题标题】:Connecting to Activemq with SSL使用 SSL 连接到 Activemq
【发布时间】:2018-12-20 08:15:14
【问题描述】:

我正在尝试作为消息接收器连接到我们的 ActiveMQ 服务器。首先,我尝试连接到本地 ActiveMQ,我下载该 ActiveMQ 用于测试目的。这已经奏效了,连接使用以下内容:

private static String url = ActiveMQConnection.DEFAULT_BROKER_URL;

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);   
Connection connection = connectionFactory.createConnection();
connection.start();

现在我需要连接到服务器上的 ActiveMQ,并且需要使用 SSL。我已经将我们的 .crt 密钥导入 Java (cacert) 但不知道如何继续。我想我必须把url 改成这样:

url = "failover://ssl://<servername>:61617";

但仅此一项是行不通的。有没有人有任何提示,如何获得连接?提前谢谢!

【问题讨论】:

    标签: java ssl activemq


    【解决方案1】:

    找到了解决办法!

    ActiveMQSslConnectionFactory connectionFactory = new ActiveMQSslConnectionFactory(url);
    connectionFactory.setTrustStore("truststore.ts");
    connectionFactory.setTrustStorePassword("password");
    
    Connection connection = connectionFactory.createConnection();
    connection.start();
    

    您只需使用您的 CA 创建一个信任库。

    【讨论】:

      猜你喜欢
      • 2016-04-17
      • 1970-01-01
      • 2010-09-17
      • 2018-07-19
      • 1970-01-01
      • 2021-08-10
      • 1970-01-01
      • 2015-09-05
      • 2016-12-24
      相关资源
      最近更新 更多