users@glassfish.java.net

[gf-users] "Unsatisfied dependencies" injecting _at_Stateless into managed bean.

From: Grover Blue <grover.blue_at_gmail.com>
Date: Wed, 16 Jul 2014 16:25:28 -0400

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:*
@Documented
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER,
ElementType.TYPE})
public @interface MyClient


*EJB interface:*
@Local
public interface SessionSettingsBeanLocal

*EJB implmentation:*
@Stateless
@MyClient
public class SessionSettingsBean implements SessionSettingsBeanLocal

*Managed bean:*
@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.