• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DefaultMessageListenerContainer not getting started

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is the problem I am facing.

I have topic connection factory.



This is working fine, When server is available I am able to publish message and in case if its not available it throws error.

I have two other subscribers which are listening to topic. As I have made lookupOnStartup property false for my topic and connection factory, listeners are not starting at all.

Here is topic and listener configuration.



Any idea, how listeners can be started ? I tried to lookup listener bean and calling start method, but no success.

Regards,
Anand
 
author
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By default, the DMLC will start up automatically when the Spring application context is started. This is controlled by the autoStartup property in the AbstractJmsListeningContainer set to true. There's no need to start up the listeners as you mentioned because they get invoked each time a message arrives in the DMLC.

Which message listener interface does your TCDataSubscriber bean implement? For more info, see the Spring Reference Doc's section named Receiving a message.

Bruce
 
Anand Loni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bruce,

Thanks for the quick reply.

My TCDataSubsciber implements javax.jms.MessageListener.

When I stop JMS server application throws exception saying Destination Unreachable. When I start JMS server again I can not see the DMLC created threads running.
How to test if DMLC tries to reconnect ?

Regards,
Anand
 
Bruce Snyder
author
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the error indicates, the destination cannot be reached. Can you send messages to the topic using that connection?

I find it easiest to troubleshoot situations by breaking things down to the simplest possible case. Using the Spring SingleConnectionFactory and JmsTemplate, I would do this:

  • Look up the connection
  • Send a message
  • Receive a message

  • If that works, then receive the message using the Spring DMLC and a listener instead of the JmsTemplate.

    Hope that helps.

    Bruce
     
    Anand Loni
    Ranch Hand
    Posts: 150
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Bruce,

    I have made property autoStartUp as false for my listeners, and I am starting DMLC in my context loader. I am using weblogic as application server. Now I am getting below error:




    I made sure that client Id and subscription name are unique for each listener. Any idea what went wrong ?
     
    Bruce Snyder
    author
    Posts: 10
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Well the error states that 'Client id, TCAnsPaperSubscriber471, is in use.' So it seems like a client id is being used twice. The error detail is also telling you where that client id is being used:

    "The JNDI name weblogic.jms.connection.clientid.TCAnsPaperSubscriber471 was found, and was bound to an object of type weblogic.jms.frontend.FEClientIDSingularAggregatable : FEClientIDSingularAggregatable(SingularAggregatable(<6176547454817656908.1>:302):TCAnsPaperSubscriber471)"



    Bruce
     
    Anand Loni
    Ranch Hand
    Posts: 150
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Bruce,

    Sorry, but I am not getting where client id is being used twice from the error message.

    Regard,
     
    Anand Loni
    Ranch Hand
    Posts: 150
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Bruce,

    When I looked up into my JMS server, I found that there is active connection for TCAnsPaperSubscriber471. When I destroy connection and then start my weblogic server where I deployed my application, I do not get "Client id in use" error. When Application gets up I can see active connection for TCAnsPaperSubscriber471. If I restart weblogic server again without destroying connection then I get the same error "Client Id in use".

    Is this related to autoStartup property being false for DMLC ? If yes how can I destroy connection when my application/server goes down?

    Regards,
     
    Bruce Snyder
    author
    Posts: 10
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    If the JndiObjectFactoryBean and the DMLC are both not marked to not start up by default, then I'm not sure where the connection is coming from. If I had this problem, I would grab a thread dump from the app while it's running so that I could locate the stack trace containing the JMS Connection object. This might help you understand where the connection is originating.

    Bruce
     
    Anand Loni
    Ranch Hand
    Posts: 150
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Bruce,

    Is there any way, by which I can check if there is any subscriber with the same client Id. If its there then destroy that subscriber and start subscriber again.

    I tried to implement my class implementing disposable bean and in the destroy method I called stop method on the DMLC. But when I stop server, destroy method is not called at all.

    Any idea, how I can resolve this issue ?

    Regards,
     
    Anand Loni
    Ranch Hand
    Posts: 150
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Finally I resolved this issue.

    I added shutdown hook and stopped DMLC. This hook will be called when jvm exits.

    Here is code :



    Thanks.
     
    The knights of nee want a shrubbery. And a tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic