users@glassfish.java.net

Re: Define two instances of same bean in ejb-jar and sun-ejb-jar

From: <glassfish_at_javadesktop.org>
Date: Mon, 15 Jun 2009 13:39:17 PDT

Hi Chris,

The existence of @MessageDriven on a bean class creates a message-driven bean component with a
default ejb name equal to the unqualified bean class name. That's independent of the
entries in ejb-jar.xml, unless one of the entries has a matching <ejb-name>, in which case they refer to the same component and the information in ejb-jar.xml takes precedence (although not all metadata is overridable).

If the goal is to create multiple components that use the same bean class, it's typically clearer
to not use the component-defining annotation, although there's no rule against it. There's also a known bug relating to the environment dependency processing for the multiple components / same bean class case ( https://glassfish.dev.java.net/issues/show_bug.cgi?id=6653.

None of this explains why one MDB would have received multiple messages though. Is it possible that both queue resources were mapped to the same underlying jms destination?
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=351284