Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Description
I have an test with a client that uses two EJBs
class Client { @EJB(name="ejb/CDIUseCasesCMBEAN1") static CMBean1IF cmbean1; @EJB(name="ejb/CDIUseCasesCMBEAN2") static CMBean2IF cmbean2; }
The first EJB also references the second EJB:
@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 { }
When I deploy my application, the deployment fails with the error:
[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)
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:
private ComponentView getComponentView(ViewDescription viewDescription) { final ServiceController<?> controller = serviceRegistry.getService(viewDescription.getServiceName()); if (controller == null) { return null; } return (ComponentView) controller.getValue(); }
If there is no component view, the WeldEjbInjectionServices#handleServiceLookup will instead use a lazy resource.
After that changes, my test passes fine.