JBoss Community

@EJB and Class Hierarchy

created by Markus Lutum in EJB3 - View the full discussion

Hi!

 

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;

or

@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.

Message:

Caused by: java.lang.RuntimeException: Specified reference [EJB Reference: beanInterface 'com.XXX.CarrierUC', beanName 'null', mappedName 'null', lookupName 'null', owning unit 'ComponentDeploymentContext@17671586{org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData.MyClientService}'] was matched by more than one EJB: [org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData@1e4488c3{PersonUC}, org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData@81412b66{CarrierUC}, org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData@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

Markus

 

 



Reply to this message by going to Community

Start a new discussion in EJB3 at Community