我有Artemis ActiveMQ版本2.19.0,有3组主/从:
amq1-master
amq2-slave
amq3-master
amq4-slave
amq5-master
amq6-slave
我还使用SSL连接器之间的连接这里是broker.xml从机器之一:
<connectors>
<connector name="amq1-master">tcp://amq1:61616?sslEnabled=true;trustStorePath=/home/artemis_certs/amq1/client_ts.p12;trustStorePassword=trustStorePassword</connector>
<connector name="amq1-slave">tcp://amq2:61616?sslEnabled=true;trustStorePath=/home/artemis_certs/amq2/client_ts.p12;trustStorePassword=trustStorePassword</connector>
<connector name="amq2-master">tcp://amq3:61616?sslEnabled=true;trustStorePath=/home/artemis_certs/amq3/client_ts.p12;trustStorePassword=trustStorePassword</connector>
<connector name="amq2-slave">tcp://amq4:61616?sslEnabled=true;trustStorePath=/home/artemis_certs/amq4/client_ts.p12;trustStorePassword=trustStorePassword</connector>
<connector name="amq3-master">tcp://amq5:61616?sslEnabled=true;trustStorePath=/home/artemis_certs/amq5/client_ts.p12;trustStorePassword=trustStorePassword</connector>
<connector name="amq3-slave">tcp://amq6:61616?sslEnabled=true;trustStorePath=/home/artemis_certs/amq6/client_ts.p12;trustStorePassword=trustStorePassword</connector>
</connectors>
<acceptors>
<acceptor name="netty-acceptor">tcp://amq1:61616?sslEnabled=true;keyStorePath=/home/artemis_certs/amq1/broker_ks.p12;keyStorePassword=keyStorePassword</acceptor>
</acceptors>
经纪人之间的连接工作正常。当我试图从一个生产者发送消息时,我得到了这个错误
{"@timestamp":"2021-11-24T20:31:29.439Z", "log.level": "WARN", "message":"Failed to initialize a channel. Closing: [id: 0x424f0276]", "ecs.version": "1.2.0","service.name":"test-artemis","event.dataset":"test-artemis.log",
"process.thread.name":"Thread-2 (ActiveMQ-client-netty-threads)","log.logger":"io.netty.channel.ChannelInitializer","error.type":"java.lang.Exception","error.message":"Failed to find a store at /home/artemis_cert/amq5/client_ts.p12
","error.stack_trace":[
"java.lang.Exception: Failed to find a store at /home/artemis_cert/amq5/client_ts.p12",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport.validateStoreURL(SSLSupport.java:314)",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport.loadKeystore(SSLSupport.java:262)",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport.loadTrustManagerFactory(SSLSupport.java:213)",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport.loadTrustManagers(SSLSupport.java:238)",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.SSLSupport.createContext(SSLSupport.java:162)",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.DefaultSSLContextFactory.createSSLContext(DefaultSSLContextFactory.java:64)",
"\tat org.apache.activemq.artemis.core.remoting.impl.ssl.DefaultSSLContextFactory.getSSLContext(DefaultSSLContextFactory.java:35)",
"\tat org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector.loadJdkSslEngine(NettyConnector.java:719)",
"\tat org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector.access$1400(NettyConnector.java:129)",
"\tat org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$1.initChannel(NettyConnector.java:628)",
"\tat io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)",
"\tat io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)",
"\tat io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:938)",
"\tat io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609)",
"\tat io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)",
"\tat io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463)",
"\tat io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115)",
"\tat io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650)",
"\tat io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:514)",
"\tat io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429)",
"\tat io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486)",
"\tat io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)",
"\tat io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)",
"\tat io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:387)",
"\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)",
"\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)",
"\tat org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)"]}
{"@timestamp":"2021-11-24T20:31:29.441Z", "log.level":"ERROR", "message":"AMQ214016: Failed to create netty connection", "ecs.version": "1.2.0","service.name":"test-artemis","event.dataset":"test-artemis.log","process.thread.name":"Camel (camel-1) thread #0 - JmsConsumer[example-queue]","log.logger":"org.apache.activemq.artemis.core.client","error.type":"io.netty.channel.StacklessClosedChannelException","error.stack_trace":[
"io.netty.channel.StacklessClosedChannelException",
"\tat io.netty.channel.AbstractChannel$AbstractUnsafe.ensureOpen(ChannelPromise)(Unknown Source)"]}
{"@timestamp":"2021-11-24T20:31:33.841Z", "log.level": "WARN", "message":"Failed to initialize a channel. Closing: [id: 0x62825c92]", "ecs.version": "1.2.0","service.name":"test-artemis","event.dataset":"test-artemis.log","process.thread.name":"Thread-0 (ActiveMQ-client-netty-threads)","log.logger":"io.netty.channel.ChannelInitializer","error.type":"java.lang.Exception","error.message":"Failed to find a store at /home/artemis_cert/amq5/client_ts.p12","error.stack_trace":[
下面是我的JMS连接URL的样子:
jms.artemis.broker.url=(tcp://amq1:61616,tcp://amq2:61616,tcp://amq3:61616,tcp://amq4:61616,tcp://amq5:61616,tcp://amq6:61616)?ha=true&sslEnabled=true&trustStorePath=/home/cert/client_ts.p12&trustStorePassword=trustStorePassword&keyStorePath=/home/cert/broker_ks.p12&keyStorePassword=keyStorePassword
jms.artemis.user=admin
jms.artemis.password=admin
@Configuration
public class ArtemisJmsConfiguration extends JmsConfiguration{
@Override
@Bean
public ConnectionFactory artemisConnectionFactory(
@Value("${jms.artemis.broker.url}") String brokerUrl,
@Value("${jms.artemis.user}") String user,
@Value("${jms.artemis.password}") String password
) {
ActiveMQConnectionFactory conn = new ActiveMQConnectionFactory(brokerUrl, user, password);
JmsPoolConnectionFactory factory = new JmsPoolConnectionFactory();
factory.setConnectionFactory(conn);
factory.setMaxConnections(10);
return factory;
}
}
首先,我不明白为什么在日志中我看到我的商店的错误路径,它说:* “在/home/artemis_cert/amq 5/client_ts.p12中找不到存储”* 并且在连接url中我有不同的路径 “trustStorePath=/home/cert/client_ts.p12”?
- /home/artemis_cert/amq 5/ 此文件夹位于所有artemis broker服务器上
- /home/cert/ 此文件夹位于客户端计算机上,此文件 "/home/cert/client_ts.p12” 包括所有6台artemis broker服务器上的所有trustore
我也得到其他商店的错误,这只是我上面提到的一个例子:
Failed to find a store at /home/artemis_cert/amq1/client_ts.p12;
Failed to find a store at /home/artemis_cert/amq2/client_ts.p12
etc.
2条答案
按热度按时间lztngnrs1#
当我尝试使用useTopologyForLoadBalancing = true(默认安装在类ServerLocatorConfig(artemis-jms-client-2.19.1)中)时,也出现了相同的行为。我安装了connectionFactory.setUseTopologyForLoadBalancing(false),然后这种奇怪的行为就停止了。我有一个工作的生产者,但我不知道这个设置如何影响负载平衡。
mxg2im7a2#
我认为密钥库的默认格式是JKS,你需要在你的连接URL中使用trustStoreType= PKCS 12来告诉连接器/接受器这种格式。