我有一个 JBoss 集群,其中两个节点处于 HA 共享存储模式。
当我杀死活动节点 1 时,备份节点 2 成为活动节点。
当我重新启动节点 1 时,由于故障恢复,节点 1 成为实时服务器,节点 2 再次成为备份服务器。
但是,当我再次杀死节点 1 时,节点 2 成为实时服务器,但出现以下异常:
10:38:46,545 WARN [org.apache.camel.component.jms.reply.TemporaryQueueReplyManager] (Camel (camel-poc) thread #20 - TemporaryQueueReplyManager[MY_QUEUE]) Exception inside the DMLC for Temporary ReplyTo Queue for destination MY_QUEUE, refreshing ReplyTo destination: javax.jms.JMSException: Could not create a session: IJ000470: You are trying to use a connection factory that has been shut down: java:/JmsXA
at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.allocateConnection(ActiveMQRASessionFactoryImpl.java:895)
at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.createSession(ActiveMQRASessionFactoryImpl.java:520)
at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:192)
at org.springframework.jms.listener.DefaultMessageListenerContainer.access$1400(DefaultMessageListenerContainer.java:124)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1186)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1165)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1158)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1055)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.resource.ResourceException: IJ000470: You are trying to use a connection factory that has been shut down: java:/JmsXA
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:735)
at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.allocateConnection(ActiveMQRASessionFactoryImpl.java:853)
... 8 more
当然,我不能再使用这个队列了。
这是我的消息传递子系统定义(与standalone-ha 配置中定义的基本相同):
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:admin123!}"/>
<management jmx-enabled="true"/>
<statistics enabled="true"/>
<shared-store-slave allow-failback="true"/>
<bindings-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\bindings"/>
<journal-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\journal"/>
<large-messages-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\largemessages"/>
<paging-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\paging"/>
<security-setting name="#">
<role name="guest" delete-non-durable-queue="true" create-non-durable-queue="true" consume="true" send="true"/>
</security-setting>
<address-setting name="#" redistribution-delay="1000" message-counter-history-day-limit="10" page-size-bytes="2097152" max-size-bytes="10485760" expiry-address="jms.queue.ExpiryQueue" dead-letter-address="jms.queue.DLQ"/>
<http-connector name="http-connector" endpoint="http-acceptor" socket-binding="http"/>
<http-connector name="http-connector-throughput" endpoint="http-acceptor-throughput" socket-binding="http">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0"/>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
<broadcast-group name="bg-group1" connectors="http-connector" jgroups-channel="activemq-cluster"/>
<discovery-group name="dg-group1" jgroups-channel="activemq-cluster"/>
<cluster-connection name="my-cluster" discovery-group="dg-group1" connector-name="http-connector" address="jms"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="MY_QUEUE" entries="java:/jms/queue/MY_QUEUE"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" reconnect-attempts="-1" block-on-acknowledge="true" ha="true" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" transaction="xa" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm"/>
</server>
</subsystem>
这是正常行为还是配置错误?
编辑:
消费者部署在实时服务器和备份服务器上。队列在 Camel 上下文中使用,其在上下文中定义如下:
<jee:jndi-lookup id="jmsConnectionFactory"
jndi-name="java:jboss/DefaultJMSConnectionFactory" lookup-on-startup="false"
proxy-interface="javax.jms.ConnectionFactory" />
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://cxf.apache.org/wsse/handler/hell"
trace="true" id="camel-jms-queue">
<route id="wsProxyRedirection">
<from uri="cxf:bean:cdcPocProxyWebServiceStartPoint" />
<to uri="jms:queue:MY_QUEUE" />
</route>
</camelContext>