Bug 1001610 - CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies
Summary: CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CDI/Weld, EJB, Web Services
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Stuart Douglas
QA Contact: Marek Schmidt
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-27 11:43 UTC by Aslak Knutsen
Modified: 2013-12-15 12:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-25 12:04:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WFLY-1960 0 Major Resolved CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies 2014-05-30 19:30:18 UTC

Description Aslak Knutsen 2013-08-27 11:43:03 UTC
Description of problem:

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

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


How reproducible:
100%

Steps to Reproduce:

import javax.ejb.Stateless;
import javax.jws.WebService;
 
@Stateless
@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;
 
 
@RunWith(Arquillian.class)
public class TestBeanIT {
 
    @Inject
    TestBean bean;
 
    @Deployment
    public static WebArchive createDeployment() {
        WebArchive arch =  ShrinkWrap.create(WebArchive.class);
        arch.addClass(TestBean.class);
        arch.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
        return arch;
    }
 
    @Test
    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 11:44:14 UTC
Use of @EJB on the InjectionPoint works when resolved with CDI, just not @Inject.

@RunWith(Arquillian.class)
public class TestBeanIT {
 
    @EJB
    TestBean bean;
    ...
}

Comment 2 JBoss JIRA Server 2013-09-16 20:22:45 UTC
Martin Kouba <mkouba> 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:
{quote}
* 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.
...
{quote}

Furthermore the CDI spec, 3.2.2. Bean types of a session bean:
{quote}
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.
...
{quote}

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 10:46:52 UTC
Rejecting dev_ack as per Martin's comment, as the test is invalid.

Comment 4 JBoss JIRA Server 2013-10-09 12:19:51 UTC
Martin Kouba <mkouba> 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.