| Summary: | CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Aslak Knutsen <aknutsen> |
| Component: | CDI/Weld, EJB, Web Services | Assignee: | Stuart Douglas <sdouglas> |
| Status: | CLOSED NOTABUG | QA Contact: | Marek Schmidt <maschmid> |
| Severity: | medium | Docs Contact: | Russell Dickenson <rdickens> |
| Priority: | unspecified | ||
| Version: | 6.1.0 | CC: | istudens, jharting, pmuir |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-10-25 12:04:36 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Use of @EJB on the InjectionPoint works when resolved with CDI, just not @Inject.
@RunWith(Arquillian.class)
public class TestBeanIT {
@EJB
TestBean bean;
...
}
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. Rejecting dev_ack as per Martin's comment, as the test is invalid. |
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: