users@glassfish.java.net

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

From: Reza Rahman <Reza.Rahman_at_oracle.com>
Date: Thu, 17 Jul 2014 12:06:12 -0400

This might be a bug. What happens if you remove either the qualifier or
@Local?

On 7/17/2014 11:30 AM, Grover Blue wrote:
> Changing the beans.xml to use the older pre-EE7 definition did not
> resolve the issue:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
> </beans>
>
>
>
> On Wed, Jul 16, 2014 at 4:25 PM, Grover Blue <grover.blue_at_gmail.com
> <mailto:grover.blue_at_gmail.com>> wrote:
>
> 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.
>
>
>
>
>
>
>
>
>
> --
> “If the American people ever allow private banks to control the issue
> of their currency, first by inflation, then by deflation, the
> banks...will deprive the people of all property until their children
> wake-up homeless on the continent their fathers conquered... The
> issuing power should be taken from the banks and restored to the
> people, to whom it properly belongs." -- Thomas Jefferson
>
> "Government big enough to supply everything...is big enough to take
> everything you have. The course of history shows that as a government
> grows, liberty decreases" --- Thomas Jefferson
>
> www.CampaignForLiberty.org <http://www.CampaignForLiberty.org>