[jboss-user] [EJB3] - @EJB and Class Hierarchy

Markus Lutum do-not-reply at jboss.com
Thu Apr 14 07:12:52 EDT 2011

Markus Lutum [http://community.jboss.org/people/mclu] created the discussion

"@EJB and Class Hierarchy"

To view the discussion, visit: http://community.jboss.org/message/600013#600013


Currently I am migrating an application from AS 4.2.3 to AS 6.0.0

In the old system we have a hirarchy like:

@Stateless(name = "CarrierUC")
public class CarrierUCBean extends AbstractUC implements CarrierUC {

and a subclass like

@Stateless(name = "PersonUC")
public class PersonUCBean extends CarrierUCBean implements PersonUC {


Other Session Beans inject them using 

@EJB CarrierUC m_carrierUC;
@EJB PersonUC m_personUC;

Now with Jboss 6 the system could not deploy my beans because he mention that the injected CarrierUC is not unique and I should use beanName.
Caused by: java.lang.RuntimeException: Specified reference [EJB Reference: beanInterface 'com.XXX.CarrierUC', beanName 'null', mappedName 'null', lookupName 'null', owning unit 'ComponentDeploymentContext at 17671586{org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData.MyClientService}'] was matched by more than one EJB: [org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData at 1e4488c3{PersonUC}, org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData at 81412b66{CarrierUC}, org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData at 12e9e9a{VehicleUC}].  Specify beanName explicitly or ensure beanInterface is unique.

OK, when I use
@EJB(beanName="CarrierUC") CarrierUC m_carrierUC;
it works.

Do I really have to change ALL my injection lines where I have session bean class hierarchies or is there a way to configure the old behaviour?

Thx from Germany

Reply to this message by going to Community

Start a new discussion in EJB3 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110414/e6ce1005/attachment.html 

More information about the jboss-user mailing list