0
votes

I have standard maven project in netbeans (netbeans' enterprise application), that have 1 war, 1 ejb and 1 ear modules. I want to inject with @Inject my @Stateless from ejb to war (REST class) using its interface. I have added some beans.xml files in correct folders in project, but im still getting this:

Error occurred during deployment: Exception while loading the app : WELD-001409 Ambiguous dependencies for type [LogicBean] with qualifiers [@Default] at injection point [[field] @Inject private pl.edu.amu.wmi.kino.rk.rest.ReportRest.bean]. Possible dependencies [[Session bean [class pl.edu.amu.wmi.kino.rk.data.impl.LogicBeanImpl with qualifiers [@Any @Default]; local interfaces are [LogicBean], Session bean [class pl.edu.amu.wmi.kino.rk.data.impl.LogicBeanImpl with qualifiers [@Any @Default]; local interfaces are [LogicBean]]]. Please see server.log for more details.

What am i doing wrong? I have searched the whole internet, but could not find the solution. I know it is possible because i worked on a project with such a staff. THX for any help:)

1
post the pertinent code. trying to help with this kind of question is like fixing a watch wearing oven mitts.Bill Rosmus

1 Answers

1
votes

You're coding to the interface, which is good, but you have two implementations of that interface with the same qualifiers (the default ones in this case). Without using a qualifier to disambiguate what you want injected, CDI has no idea which one to give you.

I suggest creating a @Rest qualifier (or an EJB one) and annotating the class and also annotating the injection point with the instance you want.