[jboss-jira] [JBoss JIRA] (WFLY-1960) CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies
Martin Kouba (JIRA)
jira-events at lists.jboss.org
Mon Sep 16 16:23:07 EDT 2013
[ https://issues.jboss.org/browse/WFLY-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804700#comment-12804700 ]
Martin Kouba commented on 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.
> CDI @Inject of @Stateless @WebService cause WELD-001408 Unsatisfied dependencies
> --------------------------------------------------------------------------------
>
> Key: WFLY-1960
> URL: https://issues.jboss.org/browse/WFLY-1960
> Project: WildFly
> Issue Type: Bug
> Components: CDI / Weld, EJB, Web Services
> Affects Versions: 8.0.0.Alpha4
> Reporter: Aslak Knutsen
> Assignee: Martin Kouba
>
> CDI @Inject of @WebService does not work.
> {code}
> 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 {
>
> }
> }
> {code}
> Using CDI to do a non contextual injection on a class where @EJB is used instead of @Inject works.
> {code}
> @RunWith(Arquillian.class)
> public class TestBeanIT {
>
> @EJB
> TestBean bean;
> ...
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list