• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Singleton MDB in a clustered environment

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I want a singleton MDB on my clustered app server. I thought that I could just deploy my MDB (in a jar or ear) to the deploy-hasingleton directory and I would essentially limit access to this bean to one. But it looks like jboss is trying to deploy my MDB before it deploys all the JMS stuff (I get a DefaultJMSProvider nnot found exception).

Has anyone created a singleton MDB before?

Thanks in advance.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe it is starting up JMS on one server. (It is a Singleton too), and trying to deploy the MDB on a different server.

What happens if you try to deploy your MDB into the deploy directory of just one of the nodes and not in the farm directory. Then it is literally deployed in one machine, and will be in the local JNDI tree. And in Clustering with HA-JNDI, then any machine can still find the MDB from that one machine.

Now the other big question is why you need the MDB to be deployed on only one machine. Can't think of a good use case why I would need that.

Thanks

Mark
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure what you are proposing. If I only deploy to the deploy directory on one machine, if that machine goes down then I am in trouble. I want it to failover to another node in the cluster. That is what the deploy-hasingleton is for. According to the documentation it will deploy to the master only and if the master goes down it will deploy to whatever machine takes over as the master. The jboss documentation says you can put ears, wars, jars, etc in there if you want a singleton.

This also happens when I only have one server up. deploy-hasingleton is not hot deploy so you need to bring the cluster down. When I try and bring up the first machine (the master) jboss tries to deploy my MDB before jms is deployed. This should not happen.

Why do I want this? Seems the same reason everyone else wants this as well, for processing message driven beans one at a time in order. In my case I only care about one at a time as I am writing to a lucene index. This solution is actually recommend by lucene for writing and index in a clustered env.

I see a ton of posts about people wanting to use the deploy-hasingleton and having problems but no one seems to have any answers. Any ideas would be greatly appreciated.

Thanks again.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you have read this?

When I try and bring up the first machine (the master) jboss tries to deploy my MDB before jms is deployed.



This is then a dependency issue. You can add a "depends" to the MDB to add an dependency on the JMS topic/queue. The depends can either be added as a annotation (for EJB3) or in the jboss.xml (for EJB2.x as well as EJB3).
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


You can add a "depends" to the MDB to add an dependency on the JMS topic/queue.



To clarify it looks like the problem is that jms as a whole is not up when my MDB tries to deploy. But you are saying to add a dependency on the queue my MDB uses??? If so I am not really sure how this might help. Also not sure how to depend on my queue.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Billy Newman wrote:

To clarify it looks like the problem is that jms as a whole is not up when my MDB tries to deploy.



Can you please post the console logs and the entire exception stacktrace along with any relevant MDB configurations?
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will post the code shortly. As an aside you should be able to reproduce this by creating an ear with a simple MDB in it. Deploy that ear to deploy-hasingleton, and you will see that you MDB is deployed before jms is finished. If you can get that simple test to work that would be great because I cannot!

Also I have read that instead of deploying to deploy-hasingleton to get a singleton I can annotate with:


I guess this might save the trouble of creating an ear with just the MDB in it that you want as a singleton, and you can just deploy an ear with a bunch of stuff in it including your MDB in the farm directory. Bummer is that I cannot get this to work either.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I see a ton of posts about people wanting to use the deploy-hasingleton and having problems but no one seems to have any answers. Any ideas would be greatly appreciated.



Basically, anything remotely related to Singleton is crappy and will not work. The answer is not to depend upon a Singleton for anything. Singletons are only good for cleaning the toliets and sweeping up after everyone has gone home for the day )
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The exception I get is (I cannot get the exception from the server so the best I can do is type in the exception without the stack trace):
javax.naming.NameNotFoundException: DefaultJMSProvider not bound


Simple MDB:


Queue:

 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the server log file and you should see the exception, if one was thrown.

Really the odd thing is that the default deployment sorter would deploy the jms.sar service archive before any ear, war or jar. So it is very strange that the MDB is being deployed first, when they are both in the HA-SINGLETON directory.

Mark
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bobby Anderson wrote:The exception I get is (I cannot get the exception from the server so the best I can do is type in the exception without the stack trace):
javax.naming.NameNotFoundException: DefaultJMSProvider not bound


Simple MDB:


Queue:



Hey Bobby, did you resolve your issue? I have the same issue and would appreciate any pointers to resolve the issue.
 
reply
    Bookmark Topic Watch Topic
  • New Topic