当前位置: 首页 > 知识库问答 >
问题:

从Camel JMS组件向AMQ Artemis发送消息时,无法创建会话工厂AMQ219007

严柏
2023-03-14

我尝试从Camel rout JMS组件发送消息,在某些消息上会出现以下错误。在50,000条消息中,4937条达到了497 mes/sec的平均速度。同时,在相同的设置下,经典的ActiveMQ提供了大约10,000 mes/sec

Artemis版本2.11.0。骆驼版本2.20.2

错误

Error while routing: Message has put to DEAD.LETTER.QUEUE
 org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:487)
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:516)
    at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:440)
    at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:394)
    at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:157)
    at org.apache.camel.processor.SendDynamicProcessor$1.doInAsyncProducer(SendDynamicProcessor.java:132)
    at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:445)
    at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:127)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
    at org.apache.camel.processor.WireTapProcessor$1.call(WireTapProcessor.java:158)
    at org.apache.camel.processor.WireTapProcessor$1.call(WireTapProcessor.java:153)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Suppressed: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
        ... 19 more
        Suppressed: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
            ... 19 more
            Suppressed: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Failed to create session factory; nested exception is ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
                ... 19 more
            Caused by: javax.jms.JMSException: Failed to create session factory
                at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
                at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
                at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
                at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
                at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
                ... 16 more
            Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
                at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:799)
                at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
                ... 20 more
        Caused by: javax.jms.JMSException: Failed to create session factory
            at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
            at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
            at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
            at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
            at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
            ... 16 more
        Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
            at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:799)
            at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
            ... 20 more
    Caused by: javax.jms.JMSException: Failed to create session factory
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
        at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
        ... 16 more
    Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
        at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:799)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
        ... 20 more
Caused by: javax.jms.JMSException: Failed to create session factory
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
    at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
    ... 16 more
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
    at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:799)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
    ... 20 more

骆驼路线

<?xml version="1.0" encoding="UTF-8"?>
<beans factor:name="Send to Artemis" factor:status="true"
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:cxf="http://camel.apache.org/schema/cxf"
    xmlns:factor="factor-schema"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="        http://camel.apache.org/schema/spring            http://camel.apache.org/schema/spring/camel-spring.xsd        http://www.springframework.org/schema/beans      http://www.springframework.org/schema/beans/spring-beans.xsd        http://www.springframework.org/schema/jdbc       http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd        http://www.springframework.org/schema/context    http://www.springframework.org/schema/context/spring-context.xsd        http://camel.apache.org/schema/cxf               http://camel.apache.org/schema/cxf/camel-cxf.xsd">
    <camelContext errorHandlerRef="myDeadLetterErrorHandler"
        id="e726891b-7413-4428-9bf5-f6c85116c771" xmlns="http://camel.apache.org/schema/spring">
        <interceptFrom>
            <bean method="updateMDC" ref="logInterceptorService"/>
        </interceptFrom>
        <route factor:name="Send to Artemis" id="route-4cd627f9-ba6d-43e3-ba24-4f61d8c1b69b">
            <from id="35ecd8c3-ea1e-48ee-8d1e-85815576242c" uri="timer://init?delay=-1&amp;repeatCount=50000">
                <description>Timer</description>
            </from>
            <setBody factor:component="SetBodyEndpoint"
                factor:custom-name="Установить тело сообщения"
                factor:guid="endpoint-34546317-7707-4c92-9d08-c388ea6cc390" id="endpoint-34546317-7707-4c92-9d08-c388ea6cc390">
                <simple><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  <env:Header>
    <props:MessageInfo xmlns:props="urn:cbr-ru:msg:props:v1.3">
      <props:To>uic:5454</props:To>
      <props:From>uic:newuser</props:From>
      <props:AppMessageID>guid:1134f9d42bc98c84caea7ee62c17881312</props:AppMessageID>
      <props:MessageID>guid:1429e234ae7016f981111361</props:MessageID>
      <props:MessageType>1</props:MessageType>
      <props:Priority>5</props:Priority>
      <props:CreateTime>2016-07-27T12:41:13Z</props:CreateTime>
      <props:LegacyTransportFileName>20191008 # pacs.008.001.08 # AAAACNBJXXX # BBBBRUMMYYY # 123456789.xml</props:LegacyTransportFileName>
      <props:SendTime>2016-07-27T12:41:14Z</props:SendTime>
      <props:AckRequest>false</props:AckRequest>
    </props:MessageInfo>
    <props:DocInfo xmlns:props="urn:cbr-ru:msg:props:v1.3">
      <props:DocFormat>1</props:DocFormat>
      <props:DocType>ED311</props:DocType>
      <props:EDRefID EDNo="1" EDDate="2016-07-27" EDAuthor="1203709000" />
    </props:DocInfo>
  </env:Header>
  <env:Body>
    <sen:SigEnvelope xmlns:sen="urn:cbr-ru:dsig:env:v1.1">kk
    </sen:SigEnvelope>
  </env:Body>
</env:Envelope>]]></simple>
            </setBody>
            <setHeader factor:component="SetHeaderEndpoint"
                factor:custom-name="Установить заголовки"
                factor:guid="87ba2d3e-7eff-42cd-9efc-048764539364"
                headerName="JMSDeliveryMode" id="87ba2d3e-7eff-42cd-9efc-048764539364">
                <constant>NON_PERSISTENT</constant>
            </setHeader>
            <wireTap id="18382f84-1f34-487e-a55a-a731e1ec9560" uri="jms://TEST.FROM.CAMEL?connectionFactory=#RemoteArtemisMQ">
                <description>JMS</description>
            </wireTap>
        </route>
    </camelContext>

    <bean
        class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory"
        factor:bean-type="DEFAULT" id="RemoteArtemisMQ" name="RemoteArtemisMQ">
        <constructor-arg value="tcp://192.168.58.6:61619"/>
    </bean>
</beans>

阿尔特弥斯配置

<configuration xmlns="urn:activemq"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xi="http://www.w3.org/2001/XInclude"
               xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">

   <core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="urn:activemq:core ">

      <name>0.0.0.0</name>


      <persistence-enabled>true</persistence-enabled>

      <!-- this could be ASYNCIO, MAPPED, NIO
           ASYNCIO: Linux Libaio
           MAPPED: mmap files
           NIO: Plain Java Files
       -->
      <journal-type>ASYNCIO</journal-type>

      <paging-directory>data/paging</paging-directory>

      <bindings-directory>data/bindings</bindings-directory>

      <journal-directory>data/journal</journal-directory>

      <large-messages-directory>data/large-messages</large-messages-directory>

      <journal-datasync>true</journal-datasync>

      <journal-min-files>2</journal-min-files>

      <journal-pool-files>10</journal-pool-files>

      <journal-device-block-size>4096</journal-device-block-size>

      <journal-file-size>10M</journal-file-size>

      <!--
       This value was determined through a calculation.
       Your system could perform 83.33 writes per millisecond
       on the current journal configuration.
       That translates as a sync write every 12000 nanoseconds.

       Note: If you specify 0 the system will perform writes directly to the disk.
             We recommend this to be 0 if you are using journalType=MAPPED and journal-datasync=false.
      -->
      <journal-buffer-timeout>12000</journal-buffer-timeout>


      <!--
        When using ASYNCIO, this will determine the writing queue depth for libaio.
       -->
      <journal-max-io>4096</journal-max-io>
      <!--
        You can verify the network health of a particular NIC by specifying the <network-check-NIC> element.
         <network-check-NIC>theNicName</network-check-NIC>
        -->

      <!--
        Use this to use an HTTP server to validate the network
         <network-check-URL-list>http://www.apache.org</network-check-URL-list> -->

      <!-- <network-check-period>10000</network-check-period> -->
      <!-- <network-check-timeout>1000</network-check-timeout> -->

      <!-- this is a comma separated list, no spaces, just DNS or IPs
           it should accept IPV6

           Warning: Make sure you understand your network topology as this is meant to validate if your network is valid.
                    Using IPs that could eventually disappear or be partially visible may defeat the purpose.
                    You can use a list of multiple IPs, and if any successful ping will make the server OK to continue running -->
      <!-- <network-check-list>10.0.0.1</network-check-list> -->

      <!-- use this to customize the ping used for ipv4 addresses -->
      <!-- <network-check-ping-command>ping -c 1 -t %d %s</network-check-ping-command> -->

      <!-- use this to customize the ping used for ipv6 addresses -->
      <!-- <network-check-ping6-command>ping6 -c 1 %2$s</network-check-ping6-command> -->




      <!-- how often we are looking for how many bytes are being used on the disk in ms -->
      <disk-scan-period>5000</disk-scan-period>

      <!-- once the disk hits this limit the system will block, or close the connection in certain protocols
           that won't support flow control. -->
      <max-disk-usage>90</max-disk-usage>

      <!-- should the broker detect dead locks and other issues -->
      <critical-analyzer>true</critical-analyzer>

      <critical-analyzer-timeout>120000</critical-analyzer-timeout>

      <critical-analyzer-check-period>60000</critical-analyzer-check-period>

      <critical-analyzer-policy>HALT</critical-analyzer-policy>


      <page-sync-timeout>84000</page-sync-timeout>


            <!-- the system will enter into page mode once you hit this limit.
           This is an estimate in bytes of how much the messages are using in memory

            The system will use half of the available memory (-Xmx) by default for the global-max-size.
            You may specify a different value here if you need to customize it to your needs.

            <global-max-size>100Mb</global-max-size>

      -->

      <acceptors>

         <!-- useEpoll means: it will use Netty epoll if you are on a system (Linux) that supports it -->
         <!-- amqpCredits: The number of credits sent to AMQP producers -->
         <!-- amqpLowCredits: The server will send the # credits specified at amqpCredits at this low mark -->
         <!-- amqpDuplicateDetection: If you are not using duplicate detection, set this to false
                                      as duplicate detection requires applicationProperties to be parsed on the server. -->

         <!-- Note: If an acceptor needs to be compatible with HornetQ and/or Artemis 1.x clients add
                    "anycastPrefix=jms.queue.;multicastPrefix=jms.topic." to the acceptor url.
                    See https://issues.apache.org/jira/browse/ARTEMIS-1644 for more information. -->

         <!-- Acceptor for every supported protocol -->
         <acceptor name="artemis">tcp://0.0.0.0:61619?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true</acceptor>
      </acceptors>


      <security-settings>
         <security-setting match="#">
            <permission type="createNonDurableQueue" roles="amq"/>
            <permission type="deleteNonDurableQueue" roles="amq"/>
            <permission type="createDurableQueue" roles="amq"/>
            <permission type="deleteDurableQueue" roles="amq"/>
            <permission type="createAddress" roles="amq"/>
            <permission type="deleteAddress" roles="amq"/>
            <permission type="consume" roles="amq"/>
            <permission type="browse" roles="amq"/>
            <permission type="send" roles="amq"/>
            <!-- we need this otherwise ./artemis data imp wouldn't work -->
            <permission type="manage" roles="amq"/>
         </security-setting>
      </security-settings>

      <address-settings>
         <!-- if you define auto-create on certain queues, management has to be auto-create -->
         <address-setting match="activemq.management#">
            <dead-letter-address>DLQ</dead-letter-address>
            <expiry-address>ExpiryQueue</expiry-address>
            <redelivery-delay>0</redelivery-delay>
            <!-- with -1 only the global-max-size is in use for limiting -->
            <max-size-bytes>-1</max-size-bytes>
            <message-counter-history-day-limit>10</message-counter-history-day-limit>
            <address-full-policy>PAGE</address-full-policy>
            <auto-create-queues>true</auto-create-queues>
            <auto-create-addresses>true</auto-create-addresses>
            <auto-create-jms-queues>true</auto-create-jms-queues>
            <auto-create-jms-topics>true</auto-create-jms-topics>
         </address-setting>
         <!--default for catch all-->
         <address-setting match="#">
            <dead-letter-address>DLQ</dead-letter-address>
            <expiry-address>ExpiryQueue</expiry-address>
            <redelivery-delay>0</redelivery-delay>
            <!-- with -1 only the global-max-size is in use for limiting -->
            <max-size-bytes>-1</max-size-bytes>
            <message-counter-history-day-limit>10</message-counter-history-day-limit>
            <address-full-policy>PAGE</address-full-policy>
            <auto-create-queues>true</auto-create-queues>
            <auto-create-addresses>true</auto-create-addresses>
            <auto-create-jms-queues>true</auto-create-jms-queues>
            <auto-create-jms-topics>true</auto-create-jms-topics>
         </address-setting>
      </address-settings>

      <addresses>
         <address name="DLQ">
            <anycast>
               <queue name="DLQ" />
            </anycast>
         </address>
         <address name="ExpiryQueue">
            <anycast>
               <queue name="ExpiryQueue" />
            </anycast>
         </address>

      </addresses>


      <!-- Uncomment the following if you want to use the Standard LoggingActiveMQServerPlugin pluging to log in events
      <broker-plugins>
         <broker-plugin class-name="org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin">
            <property key="LOG_ALL_EVENTS" value="true"/>
            <property key="LOG_CONNECTION_EVENTS" value="true"/>
            <property key="LOG_SESSION_EVENTS" value="true"/>
            <property key="LOG_CONSUMER_EVENTS" value="true"/>
            <property key="LOG_DELIVERING_EVENTS" value="true"/>
            <property key="LOG_SENDING_EVENTS" value="true"/>
            <property key="LOG_INTERNAL_EVENTS" value="true"/>
         </broker-plugin>
      </broker-plugins>
      -->

   </core>
</configuration>

我为Artemis-Xmx6G指出了这一点,但它并没有影响任何事情,只消耗了大约5-7%的分配内存

请告诉我发生此错误的原因以及如何提高性能?

共有1个答案

邢高爽
2023-03-14

我在项目中使用了不同版本的artemis jms客户端,在我严格指出要使用哪个版本后,错误消失了

 类似资料:
  • 我正在尝试开发一个程序,将消息发送到嵌入在JBoss EAP 7.2中的ActiveMQ Artemis。我已经遵循了这个问题中给出的说明: 下面是我发送消息的方法: 我已经用密码创建了应用程序用户Mquser@123。我已在。下面是消息子系统在独立完整版中的样子。xml: 以下是独立完整版的和部分。xml 我正在使用下面的命令启动jboss 有了这些,我能够在我的一个环境中成功地将消息发送到MQ

  • 我尝试使用HikariCP池连接,但我无法启动应用程序,因为我一直在创建sesion中获取空对象。 这是我的配置: 系统 Hibernate4.3.6。最终 MariaDB v10.0(x64) HibernateUtil类 hibernate.cfg.xml 日志 正在准备使用过滤器构建会话工厂:{}hh000130:实例化显式连接提供程序:org.mariadb.jdbc。应用程序启动方法中的

  • 是否可以向特定会话发送消息? 我在客户端和一个spring servlet之间有一个未经认证的websocket。我需要在异步作业结束时向特定连接发送未经请求的消息。 正如您在这段代码中看到的,客户端可以启动一个异步作业,当它完成时,它需要end消息。很明显,我只需要给申请人发信息,而不是向所有人广播。如果有批注或方法就太好了。 更新 我试过这个: 但这将广播到所有会话,而不仅仅是指定的会话。 更

  • 问题内容: 我正在尝试使用hibernate模式创建项目,但如果删除该行,则在create所在行中有异常- 项目将成功运行。我正在寻找解决方案,我阅读了这篇文章,并添加了依赖性,但这并不能解决问题 行是: 等于代码中的行: 依存关系 问题答案: 从Hibernate v3.6起,注释类已合并到核心中。您已经指定了对非常旧的注释jar的依赖关系,而该注释jar无法使用Hibernate core 5

  • 我的Hibernate查询SessionFactory sessionFactory=new Configuration(). confiure(). buildSessionFactory(); sess=sessionFactory.openSession()有问题;我在每个函数中都调用它,我如何避免它只创建一次sessionFactory

  • 问题内容: 我在Hibernate 4中生成会话工厂时遇到问题。在Hibernate 3中,我很简单地做到了: 现在,我需要将ServiceRegistry类传递给buildSessionFactory,但是Javadocs对如何执行此操作非常含糊。有小费吗? 问题答案: 是的,他们已经弃用了先前的buildSessionFactory API,并且做起来很容易..您可以执行类似的操作。 编辑 :