My problem differs from both WELD-001408 Unsatisfied dependencies when injecting EntityManager and WELD-001408 Unsatisfied dependencies. While those issues dealt with trying to inject a managed bean into a stateless EJB, I'm trying to do the reverse.
I'm getting an "Unsatisfied dependencies" when attempting to inject a @Stateless @Local interfaced bean into a web managed bean. I'm building an EAR with various EJB modules and a web module, running Glassfish 4 build 89 on JDK 8. Below are the details of the error and project config.
First, here is the error:
SEVERE: Exception while loading the app
SEVERE: Undeployment failed for context /platform-app
SEVERE: Exception while loading the app : CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [SessionSettingsBeanLocal] with qualifiers [@MyClient] at injection point [[BackedAnnotatedField] @Inject @MyClient private com.comp.jsf.dropdown.Settings.settingsBean]
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [SessionSettingsBeanLocal] with qualifiers [@MyClient] at injection point [[BackedAnnotatedField] @Inject @MyClient private com.comp.jsf.dropdown.Settings.settingsBean]
Custom qualifier (in library project):
@Documented
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
public @interface MyClient
EJB interface (in library project):
@Local
public interface SessionSettingsBeanLocal
EJB implmentation (in EJB module project):
@Stateless
@MyClient
public class SessionSettingsBean implements SessionSettingsBeanLocal
Managed bean (in web project - used for JSF):
@Named
@javax.faces.view.ViewScoped
public class Settings implements Serializable {
@Inject
@MyClient
private SessionSettingsBeanLocal settingsBean;
Lastly, all of my beans.xml files (EJB modules, web) look like the following. The libraries, which contain the interface and qualifier, don't have a beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="annotated">
</beans>
The @Stateless EJB should register itself, but it's not found.