• 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

MDB deployment on JBoss

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

I am trying to deploy a MDB application onto JBoss 5.1.0 instance. The MDB in discussion has a timer associated with it. I am seeing two issues that I am trying to get to the root of:

1. The messages that I am sending from a ServletContextListener implementation are not being received by the MDB. I do not see any exceptions in the server log file, but in looking at the admin console, I see that the message count on the queue is not going up either, making me think that either the counter on the console is buggy, or really my messages are not being delivered. What is annoying is that JBoss is silent about it, does not want to give any error!

2. The MDB has a timer associated with it. The way I have defined the timer is that it should fire the first time 5 minutes after the timer is setup, and then every 30 minutes. The purpose of sending the message from the ServletContextListener implementation above is to initialize/setup the timer. Unfortunately, although as i note above, the messages i am sending are not being processed, but, strangely enough, the method that is annotated as @Timeout does fire up immediately on deployment. Why is this happening.

For problem #1 above, I think it has something to do with the way I have set up my queue and how I am mapping the queue inside the ServletContextListener and the MDB setup itself. I have tried many combos, but all in vain.

For problem #2 above, i am really in the dark...do not know why it is displaying this behavior.

So, HELP!!!

Enough said, some code now:

I define my destinations inside a *-destinations-service.xml file, which is pakaged inside the META-INF folder of the ejb-jar file. The definition looks like this:



My MDB looks like this:



My ServletContextListener Implementation looks like this:



Please let me know if you need any more info.

Thanks in advance for all your help!!!
 
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


Wrong value. By default when you don't specify the JNDI name for your queue in your queue config file (the *-service.xml), JBoss binds it to queue/[name-of-the-queue]. So in this example, it's going to be bound to queue/Deals (and the other one at queue/RssDeals).

So change the "destination" activation property value to:

 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, tried that, and no change. Still the same .

Another question - what does the annotation below do?

My understanding is that it tells the MDB not to start till the above service (JMS queue) is available. Is that correct? Does it do anything else? Could it be playing a role in what I am experiencing?
 
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

Sanjeev Verma wrote:
Another question - what does the annotation below do?

My understanding is that it tells the MDB not to start till the above service (JMS queue) is available. Is that correct?



Yes, that's correct.

Yup, tried that, and no change. Still the same



Did you even change the "mappedName" attribute in the @Resource injection of servlet to match the queue jndi name?
 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Jaikiran, very appreciated.

To answer your question - Yes, I did, and it did not make a difference.

I did try something else though, and that worked. I basically built a standalone java client to send messages to the two queues, and that did activate the MDBs. So that makes me believe that the MDBs are set up properly, its is only the part where i am sending messages from inside my ServletContextListener that is not working for some reason. My Java client impl looks like this:



And my MDB looks like this:



Finally, my ServletContextListener impl looks like this:



And I do see some more strange behavior on the timer, but i will save that question for another thread.

Thanks again for all your help.
 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bumping this...any help on how to get my servletcontextlistener impl send messages to the MDB? Please!

Thanks
Sanjeev
 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so I had another breakthrough today. After carefully examining the difference between my standalone java client that was sending the messages to the servletcontextlistener impl that was not successful, I saw only one difference - the parameters that I was passing in the createSession() method of the Connection. In the client, it looks like this:



In the ServletContextListener impl, it looked like this:



So, while I was trying to get a non transacted session in the java client, I was trying to get a transacted session from inside the servletcontextlistener impl. I changed the boolean parameter to false, and sure enough, everything came together!

But surely this is not a good thing. My question is, how can I get a transacted session? I tried using the XAConnectionfactory instead of Connectionfactory to get the jmsConnection, but that did not help. Any ideas please?

Thanks for all your help!
 
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
In your servlet code, I don't see any transaction being started/commited before and after sending the messages. You might want to use the UserTransaction to begin/commit the transaction in the servlet code, if you want to use transacted queue session.

By the way, why do you want a transacted queue session? Do you want to send multiple messages from the same session as part of a transaction? i.e. msg1 and msg2 will be sent as a group when using the transacted queue session. Is this the behaviour you desire?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic