Results 1 to 2 of 2

Thread: DefaultMessageListenerContainer does not release JMS connection on stop.

  1. #1
    Join Date
    Apr 2008
    Posts
    2

    Default DefaultMessageListenerContainer does not release JMS connection on stop.

    I'm trying to write some integration tests that make use of JMS Queue.

    As part of the setUp() call I want to drain the Queue of existing messages.

    We have multiple Queues to drain and the test may only use some of the available queues. So I want to drain the queues first, stop the containers and only start the ones needed in the test code.

    However I can't just use stop() as, DefaultMessageListenerContainer doesn't appear to release the connections to the server on calls to stop().

    I've tried combinations of
    * stop
    * shutdown
    * destroy

    and then followed with:
    * initialize

    And they give me the error:
    11/04/2008 11:28:09 ERROR org.springframework.jms.listener.DefaultMessageLis tenerContainer [server1ListenerContainer-2] - Setup of JMS message listener invoker failed - trying to recover
    weblogic.jms.common.IllegalStateException: [JMSClientExceptions:055082]The connection is closed
    at weblogic.jms.client.JMSConnection.getFrontEndDispa tcher(JMSConnection.java:494)
    at weblogic.jms.client.JMSConnection.setupJMSSession( JMSConnection.java:469)
    at weblogic.jms.client.JMSConnection.createSessionInt ernal(JMSConnection.java:437)
    at weblogic.jms.client.JMSConnection.createSession(JM SConnection.java:423)
    at weblogic.jms.client.WLConnectionImpl.createSession (WLConnectionImpl.java:536)
    at org.springframework.jms.support.JmsAccessor.create Session(JmsAccessor.java:200)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer.access$1000(DefaultMessageListenerC ontainer.java:116)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.initRes ourcesIfNecessary(DefaultMessageListenerContainer. java:883)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(DefaultMessageListenerContainer.java:869)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.run(Def aultMessageListenerContainer.java:810)
    at java.lang.Thread.run(Thread.java:595)


    The methods I think I should use are all protected:
    * refreshConnectionUntilSuccessful()
    * refreshDestination()

    Am I missing something?
    Should I just define a DMLC for setUp() use only?
    Suggestions welcome.

    Thanks
    Bae

  2. #2
    Join Date
    Apr 2008
    Posts
    2

    Default

    For now I have created a drain specific beans for the message listener and DMLC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •