7 Replies Latest reply on Nov 11, 2011 8:05 AM by Cleverson Sacramento

    Error defining CDI Alternatives on AS7

    Wilson Guimarães Newbie

      Hi,

       

      We're testing an app with CDI Alternatives and the following error is shown during the deployment:

       

      ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."jboss-alternatives-scenario1-webapp.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss-alternatives-scenario1-webapp.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [MyAlternativeInterface] with qualifiers [@Default] at injection point [[field] @Inject private examples.MyBean.alternative]

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

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

          at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]

          at java.lang.Thread.run(Thread.java:680) [:1.6.0_26]

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [MyAlternativeInterface] with qualifiers [@Default] at injection point [[field] @Inject private examples.MyBean.alternative]

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

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

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

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

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

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

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

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

          ... 5 more

       

      The scenario being tested (https://github.com/zyc/jboss-as7-lab/tree/master/alternatives/scenario1) is the following:

       

      • One project called cdijar that defines an interface (MyAlternativeInterface.java), a bean (MyBean.java) with an injected MyAlternativeInterface property and an empty beans.xml.
      • Another project, called webapp, that has cdijar as a dependency. On this project there are an alternative implementation for MyAlternativeInterface (MyAlternative.java), a managed bean where MyBean is injected (MyManagedBean.java), the beans.xml activating the alternative and  index.xhtml with a button that calls MyManagedBean in order to print a message on console.

       

      Any ideas on what's happening?

       

      Best regards,

      Cleverson Sacramento

      Wilson Guimarães