2 Replies Latest reply on Nov 28, 2013 12:35 PM by Cristian Miranda

    Unsatisfied dependencies for type [MessageBus] with qualifiers [@Default] at injection point [field] @Inject

    Cristian Miranda Newbie

      Hi guys,

       

      I have an application using Errai 2.4.2.Final and I'm not being able to inject MessageBus / RequestDispatcher in our CDI beans, it throws an exception:

       

      WELD-001408 Unsatisfied dependencies for type [MessageBus] with qualifiers [@Default] at injection point [[field] @Inject private app.server.service.trading.TradingPerformance.messageBus

       

      This is my bean:

       

      @ApplicationScoped
      @Service
      public class TradingPerformance implements MessageCallback {
      
          @Inject
          private MessageBus messageBus;
      
          // This is my workaround
          //private ServerMessageBus messageBus = ErraiServiceSingleton.getService().getBus();
      
          // ...
      
      }
      
      
      

       

      I've talked with csa about this in errai IRC freenode chat and we checked a few things:

      • Being injecting MessageBus in a CDI bean
      • Having errai-weld-integration.jar as part of our libraries
      • Tried in a tutorial application and it worked!

       

      Is this related to [ERRAI-335] RequestDispatcher cannot be injected when using Errai CDI - JBoss Issue Tracker ?

       

      What am I missing?

      Thanks!

        • 1. Re: Unsatisfied dependencies for type [MessageBus] with qualifiers [@Default] at injection point [field] @Inject
          Max Barkley Expert

          Hi Cristian,

           

          Could you post the console output from when your app starts? More specifically, are you seeing messages from CDIExtensionPoints?

          • 2. Re: Unsatisfied dependencies for type [MessageBus] with qualifiers [@Default] at injection point [field] @Inject
            Cristian Miranda Newbie

            Hi Max,

             

                 Thanks for the quick answer. I forgot to tell that the application works fine, it only fails when executing tests: mvn clean test

             

            -------------------------------------------------------------------------------

            Test set: app.server.service.StrategyDAOTest

            -------------------------------------------------------------------------------

            Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.382 sec <<< FAILURE!

            app.server.service.StrategyDAOTest  Time elapsed: 1.453 sec  <<< ERROR!

            org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [MessageBus] with qualifiers [@Default] at injection point [[field] @Inject private app.server.service.trading.TradingPerformance.messageBus]

              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:312)

              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)

              at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:144)

              at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)

              at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:383)

              at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:368)

              at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)

              at org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer.startContainer(TestContainer.java:272)

              at org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer.deploy(WeldEEMockContainer.java:105)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)

              at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:606)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

              at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:606)

              at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

              at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:606)

             

            Thanks,