Bug 1001610 - CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies
CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CDI/Weld, EJB, Web Services (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Stuart Douglas
Marek Schmidt
Russell Dickenson
Depends On:
  Show dependency treegraph
Reported: 2013-08-27 07:43 EDT by Aslak Knutsen
Modified: 2013-12-15 07:28 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-10-25 08:04:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-1960 Major Resolved CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies 2014-05-30 15:30:18 EDT

  None (edit)
Description Aslak Knutsen 2013-08-27 07:43:03 EDT
Description of problem:

CDI @Inject of a EJB @WebService does not work.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

import javax.ejb.Stateless;
import javax.jws.WebService;
public class TestBean {
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
public class TestBeanIT {
    TestBean bean;
    public static WebArchive createDeployment() {
        WebArchive arch =  ShrinkWrap.create(WebArchive.class);
        arch.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
        return arch;
    public void fooTest() throws Exception {

Actual results:
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [TestBean] with qualifiers [@Default] at injection point [[field] @Inject org.cedj.geekseek.web.rest.core.test.TestBeanIT.bean]

Expected results:

Test Pass, Green bar!

Additional info:
Comment 1 Aslak Knutsen 2013-08-27 07:44:14 EDT
Use of @EJB on the InjectionPoint works when resolved with CDI, just not @Inject.

public class TestBeanIT {
    TestBean bean;
Comment 2 JBoss JIRA Server 2013-09-16 16:22:45 EDT
Martin Kouba <mkouba@redhat.com> made a comment on jira WFLY-1960

The problem is the {{TestBean}} does NOT define a local client view - it doesn't implement a business interface and does not satisfy no-interface view requirements either. It only has a *web service client view*. See also EJB spec, 4.9.8 Session Bean’s No-Interface View:
* If the bean does not expose any other client views (local, remote, no-interface, 2.x Remote Home, 2.x Local Home, Web Service) and its implements clause is empty, the bean defines a no-interface view.

Furthermore the CDI spec, 3.2.2. Bean types of a session bean:
The unrestricted set of bean types for a session bean contains all local interfaces of the bean and their superinterfaces. If the session bean has a bean class local view, the unrestricted set of bean types contains the bean class and all superclasses.

I believe that "bean class local view" is referencing EJB no-interface view (I'm not sure though and will raise a CDI spec issue). If so the set of bean types for TestBean contains only {{java.lang.Object}} and so the test deployment should result in unsatisfied dependency.

I'm not sure whether @EJB injection should work or not, but given that JAX-WS web services are accessible via JNDI it may work by coincidence.

Note that if you annotate {{TestBean}} with {{javax.ejb.LocalBean}} (explicitly state a session bean exposes a no-interface view) the test passes.
Comment 3 Stuart Douglas 2013-10-01 06:46:52 EDT
Rejecting dev_ack as per Martin's comment, as the test is invalid.
Comment 4 JBoss JIRA Server 2013-10-09 08:19:51 EDT
Martin Kouba <mkouba@redhat.com> updated the status of jira WFLY-1960 to Resolved

Note You need to log in before you can comment on or make changes to this bug.