activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <david.delb...@oma.be>
Subject createQueueConnection throws "Setting clientID on a used Connection is not allowed"
Date Mon, 02 Aug 2010 08:55:20 GMT
Hello,

We are using activeMQ 5.2


We followed activeMQ instructions on how to add a queue to JBoss server, 
we are using it with following code, which worked great when we were 
using activemq + tomcat 5.5:

    try {
                 initCtx = new InitialContext();
                 QueueConnectionFactory connectionFactory =
    (QueueConnectionFactory)initCtx.lookup(this.connectionFactoryJNDIName);
                 Queue destination =
    (Queue)initCtx.lookup(this.queueJNDIName);
                 QueueConnection queueConnection = null;
                 try{
                     queueConnection =
    connectionFactory.createQueueConnection(); // throws error
                     // snip
                 } finally {
                     try{
                         if (queueConnection!=null)
                         queueConnection.close();
                     } catch (JMSException e){
                         log.error("Could not close event
    queue"+queueJNDIName,e);
                     }
                 }


However, on a regular basis, we get this error message from this code, 
which happens for unknown reasons:

    javax.jms.IllegalStateException: Setting clientID on a used
    Connection is not allowed
             at
    org.apache.activemq.ra.ActiveMQManagedConnectionFactory.matchManagedConnections(ActiveMQManagedConnectionFactory.java:192)
             at
    org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:219)
             at
    org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
             at
    org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
             at
    org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
             at
    org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
             at
    org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
             at
    org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:94)
             at
    org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
             at
    org.apache.activemq.ra.ActiveMQConnectionFactory.createQueueConnection(ActiveMQConnectionFactory.java:120)
             at
    be.rmi.shark.JMSEventManager.sendEvent(JMSEventManager.java:131)

This is a major problem for us, as if message are not delivered to 
queue, the processes that must send those messages refuse their 
operations, leading to user operation being canceled, leading to angry 
users. Why is activeMQ sending those error message, how to prevent them? 
Did  i do sometinh wrong. Also, here is our queue definition in jboss:

    <tx-connection-factory>
    <jndi-name>activemq/QueueConnectionFactory</jndi-name>
    <local-transaction/>
    <use-java-context>false</use-java-context>
    <track-connection-by-tx/>
    <rar-name>activemq-5.2.0.rar</rar-name>
    <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
    <ServerUrl>tcp://localhost:61616</ServerUrl>
    <UserName>*******</UserName>
    <Password>*******</Password>
    <min-pool-size>1</min-pool-size>
    <max-pool-size>200</max-pool-size>
    <blocking-timeout-millis>30000</blocking-timeout-millis>
    <idle-timeout-minutes>3</idle-timeout-minutes>
    </tx-connection-factory>

    <mbean code="org.jboss.resource.deployment.AdminObject"
    name="activemq.queue:name=myqueue">
    <attribute name="JNDIName">activemq/queue/myqueueentry</attribute>
    <depends
    optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-5.2.0.rar'</depends>
    <attribute name="Type">javax.jms.Queue</attribute>
    <attribute name="Properties">PhysicalName=WF.IncomingEvents</attribute>
    </mbean>




At about the same time, on a regular basis, randomly, one of our 
activeMQ clients get stuck in a receive() call. The analysis of activemq 
server show that this client is not longer connected (number of 
consumers on queue=0), and a netstat on the client machine show that 
there is no more TCP connection between client and server. However, for 
some unknown reason, the receive() call does not fail, it just get 
frozen inside activemq api, on a wait() call, which does not look very 
reliable.


thanks for any kind of help, we are a bit clueless on this for now.

-- 
David Delbecq
ICT
Institut Royal Météorologique
Ext:557


Mime
View raw message