简体   繁体   中英

Spring Durable JMS Subscriber in TomEE (Setting clientID on a used Connection is not allowed)

I am in the process of updating an application that ran on TomEE 7 to TomEE 8 and in doing so we started to receive errors in regards to our Spring message listener containers. TomEE 8 runs Apache Active MQ 5.16 where TomEE 7 ran Apache Active MQ 5.15.13.

Within Spring we are obtaining the connection factory via a JNDI lookup which is defined in our tomee.xml as follows

<tomee>

  <Connector id="resources/jms/ConnectionFactory" type="javax.jms.ConnectionFactory">
      ResourceAdapter=ActiveMQResourceAdapter
      TransactionSupport xa
      PoolMaxSize 10
      PoolMinSize 0
      ConnectionMaxWaitMilliseconds 15000
      ConnectionMaxIdleMinutes 15
      MaxSessions=5
  </Connector>

  <Resource id="ActiveMQResourceAdapter" type="ActiveMQResourceAdapter">
      BrokerXmlConfig=xbean:file:conf/activemq.xml
      ServerUrl=tcp://localhost:61616
  </Resource>

</tomee>

Within Spring we get the connection factory as follows

<jee:jndi-lookup id="jmsFactory" jndi-name="jms/ConnectionFactory" expected-type="javax.jms.ConnectionFactory" />

The DefaultMessageListenerContainers are configured as follows

<jms:listener-container container-type="default" connection-factory="jmsFactory" client-id="clientId" cache="connection" destination-type="durableTopic" transaction-manager="transactionManager">
        <jms:listener id="responses" destination="response" ref="msgHandler" />
    </jms:listener-container>

And this all works as expected on TomEE 7, however, now that we have moved to TomEE 8 our DefaultMessageListenerContainers are throwing the following exception

[org.springframework.jms.listener.DefaultMessageListenerContainer] - Could not refresh JMS Connection for destination 'response' - retrying using FixedBackOff{interval=5000, currentAttempts=9, maxAttempts=unlimited}. Cause: Setting clientID on a used Connection is not allowed

Clearly we are doing something that is not correct with the update, what is the proper way to configure DMLC with durable topics with a JTA managed transaction?

After further testing I was able to figure out that the issue was related to the max pool size configured on the connection factory in tomee.xml. Bumping this number up I was able to get past this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM