[jboss-jira] [JBoss JIRA] (WFLY-4345) ServiceNotFoundException for EJB referencing another EJB

Stuart Douglas (JIRA) issues at jboss.org
Sun Feb 15 23:29:49 EST 2015


    [ https://issues.jboss.org/browse/WFLY-4345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040348#comment-13040348 ] 

Stuart Douglas commented on WFLY-4345:
--------------------------------------

Your fix is ok for now. The underlying issue is that with the application client the view services are never actually started, so they will never be present (on the server CDI depends on all the EJB views, so they will always be up).

> ServiceNotFoundException for EJB referencing another EJB
> --------------------------------------------------------
>
>                 Key: WFLY-4345
>                 URL: https://issues.jboss.org/browse/WFLY-4345
>             Project: WildFly
>          Issue Type: Bug
>          Components: CDI / Weld
>            Reporter: Jeff Mesnil
>            Assignee: Stuart Douglas
>
> I have an test with a client that uses two EJBs
> {noformat}
> class Client {
>   @EJB(name="ejb/CDIUseCasesCMBEAN1")
>   static CMBean1IF cmbean1;
>   @EJB(name="ejb/CDIUseCasesCMBEAN2")
>   static CMBean2IF cmbean2;
> }
> {noformat}
> The first EJB also references the second EJB: 
> {noformat}
> @Stateless(name="CDIUseCasesCMBEAN1")
> @Remote({CMBean1IF.class})
> public class CMBean1 implements CMBean1IF {
>     @EJB(name="ejb/CDIUseCasesCMBEAN2")
>     CMBean2IF cmbean2;
> }
> @TransactionManagement(TransactionManagementType.CONTAINER) 
> @Stateless(name="CDIUseCasesCMBEAN2")
> @Remote({CMBean2IF.class})
> public class CMBean2 implements CMBean2IF {
> }
> {noformat}
> When I deploy my application, the deployment fails with the error:
> {noformat}
> [javatest.batch] 11:39:17,668 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."cditestsusecases.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."cditestsusecases.ear".WeldStartService: Failed to start service
> [javatest.batch]        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.4.Final.jar:1.2.4.Final]
> [javatest.batch]        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
> [javatest.batch]        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
> [javatest.batch]        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
> [javatest.batch] Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.deployment.subunit."cditestsusecases.ear"."cditestsusecases_ejb.jar".component.CDIUseCasesCMBEAN2.VIEW."com.sun.ts.tests.jms.ee20.cditests.usecases.CMBean2IF".REMOTE not found
> [javatest.batch]        at org.jboss.msc.service.ServiceContainerImpl.getRequiredService(ServiceContainerImpl.java:669) [jboss-msc-1.2.4.Final.jar:1.2.4.Final]
> [javatest.batch]        at org.jboss.as.weld.services.bootstrap.WeldEjbInjectionServices.getComponentView(WeldEjbInjectionServices.java:149)
> [javatest.batch]        at org.jboss.as.weld.services.bootstrap.WeldEjbInjectionServices.handleServiceLookup(WeldEjbInjectionServices.java:124)
> [javatest.batch]        at org.jboss.as.weld.services.bootstrap.WeldEjbInjectionServices.registerEjbInjectionPoint(WeldEjbInjectionServices.java:106)
> {noformat}
> As far as I can tell, the application is correctly built.
> The client jar contains the Client classes and the beans remote interfaces.
> The EJB jar contains the bean remote interfaces and classes.
> I debugged WildFly and fixed the issue by updating org.jboss.as.weld.services.bootstrap.WeldEjbInjectionServices#getComponentView to take into account that the EJB's view service may not be UP yet when the CMBean2IF EJB is injected into CMBean1.cmbean2 field:
> {noformat}
>     private ComponentView getComponentView(ViewDescription viewDescription) {
>         final ServiceController<?> controller = serviceRegistry.getService(viewDescription.getServiceName());
>         if (controller == null) {
>             return null;
>         }
>         return (ComponentView) controller.getValue();
>     }
> {noformat}
> If there is no component view, the WeldEjbInjectionServices#handleServiceLookup will instead use a lazy resource.
> After that changes, my test passes fine.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jboss-jira mailing list