I'm working on upgrading an app from Weld 1.1.10 to Weld 2.1.2. We're using SE mode.
I went through and upgraded my beans.xml to match CDI 1.1 and set discovery to all in all of my JARs.
However, when I run, I get errors like this:
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type UserRegistrationManager with qualifiers @Default
at injection point [UnbackedAnnotatedParameter] Parameter 1 of [UnbackedAnnotatedConstructor] @Inject com.mycompany.invitation.impl.InvitationUserServiceImpl(UserRegistrationManager, @ValidationReady Event<Object>, UserAccountManager, UserLookup)
- Managed Bean [class com.mycompany.registration.impl.UserRegistrationManagerImpl] with qualifiers [@Any @Default],
- Managed Bean [class com.mycompany.registration.impl.UserRegistrationManagerImpl] with qualifiers [@Any @Default]
I don't get this for every class, but I do get it for classes within this specific chain (and there's 18 failures in total). My type hierarchy looks like this:
RegistrationManager (interface) -> AbstractRegistrationManagerImpl (abstract base class)
UserRegistrationManager (extends interface) -> UserRegistrationManagerImpl (implements UserRegistrationManager, extends AbstractRegistrationManagerImpl).
In total, there are 4 sets of these. The classes that work directly with them all report this error. I checked, both constructor based injection and field based injection throw this error. Any idea why?
Turns out, in Weld 1.1.10 I was using an extension to install some custom beans. In Weld 2.1.2 it was causing a duplicate bean to be loaded. Removing this extension removed the duplicates.