3 Replies Latest reply on May 20, 2013 1:41 AM by Nicklas Karlsson

    CDI Injection into a Resource Adapter

    Tin Tvrtkovic Newbie

      Hi,

       

      I'm trying to inject a POJO into a resource adapter (using a setter and @Inject). The POJO is in a separate JAR. If I leave out the JAR, Weld complains about the unsatisfied dependency (which is expected). If I include it, however, no Weld error is thrown but the injection doesn't happen at all. I'm expecting the injection to occur before the call to start.

       

      Am I doing something wrong? Using 7.1.1. Final.

       

      Thanks in advance

        • 1. Re: CDI Injection into a Resource Adapter
          Nicklas Karlsson Master

          What complains on unsatisfied dep when the jar is not around?

          • 2. Re: CDI Injection into a Resource Adapter
            Tin Tvrtkovic Newbie

            15:43:50,892 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016008: Starting weld service for deployment XXX.ear

            15:43:52,661 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."XXX.ear".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."XXX.ear".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [DataProviderService] with qualifiers [@Default] at injection point [[parameter 1] of [method] @Inject public yyy.setProxy(DataProviderService)]

                at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at oorg.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) [rt.jar:1.6.0_24]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.6.0_24]

                at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]

            Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [DataProviderService] with qualifiers [@Default] at injection point [[parameter 1] of [method] @Inject public yyy.setProxy(DataProviderService)]

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

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

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

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

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

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

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

                at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)

                at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)

                ... 5 more

             

            The RAR is inside an EAR, if it changes anything.

            • 3. Re: CDI Injection into a Resource Adapter
              Nicklas Karlsson Master

              Try to list the complete deployment archive architecture + class signatures + qualifiers for the involved classes, is it something like

               

              EAR

                   /lib

                       pojo.jar

                           SomeClassImplementingDataProviderService.class

                       resource.rar

                           DataProviderService.class

               

              ?

               

              and you have beans.xml in both the jar and the rar?