File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Problems using Message Driven Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problems using Message Driven Beans" Watch "Problems using Message Driven Beans" New topic

Problems using Message Driven Beans

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 186

Dear friends,

I am using Websphere Application Server 6.1 and RAD 7.0 (J2EE 1.4, EJB 2.0)
I deployed two EAR files EAR1 and EAR2 both having different jar files.

I have used MDB in both the EAR files.
Whenever i put a message in the queue, i want the MDB EAR 1 only to be triggered. But, in my case alternate messages trigger the MDB in EAR 2.

I still have two different Queue Connection Factories,Queues and Activation Specifications for both the EARs.

Please provide me in solving this problem.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32804

If you have two different queues, the second ear shouldn't be picking it up as they would use different queue names or ports. if you have two pointers to the same queue, there could be a problem though.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 186

Dear Jeanne & friends,

Thanks for the reply. I am sure that there are no same pointers to the queue because, alternate messages correctly come into EAR 1 application.

May be my explanation wasn't clear.

The scenario of my problem is
Suppose there are 5 messages and i want all the 5 messages to be processed only by EAR 1 then, the following happens: My MDB must only call an EJB in EAR 1.

Message Queue -> MDB1 -> EAR 1 ->Receives Message 1

Message Queue -> MDB1 -> EAR 2 ->Receives Message 2

Message Queue -> MDB1 -> EAR 1 ->Receives Message 3

Message Queue -> MDB1 -> EAR 2 ->Receives Message 4

Message Queue -> MDB1 -> EAR 1 ->Receives Message 5

The EJB in EAR 2 is having different java programs. I want my MDB to call only the EJBs in EAR 1.

Hope this is clear. Please provide your help.

Thanks & Regards,
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Hello Vijay,

Let me understand your scenario. You have MDB's in both EAR1 and EAR2. You want the messages to be consumed by the MDB's either in EAR1 or EAR2. In short you are clustering your MDB's in 2 different EAR files. Now all your business logic is embedded in EJB's that are deployed only in EAR1. You want all the MBD's to make calls to EJB's in EAR1... right?

Is this what you are trying to do? If yes, then in my opinion you will have to make remote calls to your EJB's i.e get a remote reference to your EJBObject and call the business methods. Your MDB's in EAR2 are just like any other java client trying to access EJB's, which has to be done through a remote reference.

Let us know if this helps.

Shailesh Kini.
Anna Madhusudhanan

Joined: Jan 03, 2006
Posts: 8
I agree. Here's the link:
subject: Problems using Message Driven Beans
jQuery in Action, 3rd edition