1 Reply Latest reply on Dec 6, 2006 7:52 PM by npujol

    The connection has already a clientID

    praline

      Hi,

      Trying to refactor a piece of code from a friend from 2001, I have a JMS warning:

      20:50:28,000 INFO [JMSContainerInvoker] Trying to reconnect to JMS provider
      20:50:28,015 WARN [JMSContainerInvoker] JMS provider failure detected:
      javax.jms.IllegalStateException: The connection has already a clientID
       at org.jboss.mq.Connection.setClientID(Connection.java:521)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerCreate(JMSContainerInvoker.java:696)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker.startService(JMSContainerInvoker.java:862)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1432)
       at java.lang.Thread.run(Thread.java:534)
      20:50:28,015 INFO [JMSContainerInvoker] Reconnected to JMS provider
      


      I use jboss-4.0.2RC1 with these config files :

      - jboss.xml
      <jboss>
       <enterprise-beans>
       <message-driven>
       <ejb-name>AddSchoolListener</ejb-name>
       <configuration-name>Standard Message Driven Bean</configuration-name>
       <destination-jndi-name>topic/addschool</destination-jndi-name>
       <mdb-user>TPCAddSchool</mdb-user>
       <mdb-passwd>**********</mdb-passwd>
       <mdb-client-id>TPCAddSchool</mdb-client-id>
       </message-driven>
       </enterprise-beans>
       <resource-managers>
       <resource-manager>
       <res-name>mail/Mail</res-name>
       <res-jndi-name>TPCMail</res-jndi-name>
       </resource-manager>
       </resource-managers>
      </jboss>
      


      - conf/login-config.xml modificated to use file-state-service.xml (move comments on database config)

      - default deploy/jms/file-state-service.xml, indicating to use jbossmq-state.xml file

      - conf/jbossmq-state.xml
      <StateManager>
       <Users>
       <User>
       <Name>TPCAddSchool</Name>
       <Password>**********</Password>
       <Id>TPCAddSchool</Id>
       </User>
       </Users>
       <DurableSubscriptions>
       <DurableSubscription>
       <ClientID>TPCAddSchool</ClientID>
       <Name>TPCAddSchool</Name>
       <Topic>addschool</Topic>
       </DurableSubscription>
       </DurableSubscriptions>
      </StateManager>
      


      - deploy/jms/hsqldb-jdbc-state-service.xml removed
      - other config files are default files

      If someone has an idea of what happend here, I would be happy :)
      I have searched a lot (on this forum, wiki and with google) but haven't found the solution. I'm still in the fog :(

      Thanks all and have a nice day.

      --
      Praline

        • 1. Re: The connection has already a clientID
          npujol

          Because you have defined this:

          <DurableSubscription>
           <ClientID>TPCAddSchool</ClientID>
           <Name>TPCAddSchool</Name>
           <Topic>addschool</Topic>
           </DurableSubscription>


          the clientid will be set automatically by jbossmq on the connection for user TPCAddSchool. If you want to connect to the topic you should not be specifying TopicConnection.setClientID. The exception you are seeing is per the JMS spec.