3 Replies Latest reply on Dec 26, 2013 5:30 PM by Kalyan Pasupuleti-Oracle

    WebLogic 12.1.2 fails when deploying ear with injecting extension and bean with injection of this extension in ejb

    1041666

      WebLogic 12.1.2 fails when deploying an enterprise application(ear) that contains a ejb in which injected 1) an extension 2)bean with injection of this extension.

      The following exception is thrown:

      Caused By: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [CdiExtension] with qualifiers [@Default] at injection point [[field] @Inject private test.extension.Bean1.extension]. 
      Possible dependencies [
      [Extension [class test.extension.CdiExtension] with qualifiers [@Default]; zip:/domain1/servers/AdminServer/tmp/_WL_user/test/7x6roh/lib/test-extension-0.0.1-SNAPSHOT.jar!/META-INF/services/javax.enterprise.inject.spi.Extension@1[test.extension.CdiExtension@1115deb],
      Extension [class test.extension.CdiExtension] with qualifiers [@Default]; zip:/domain1/servers/AdminServer/tmp/_WL_user/test/7x6roh/lib/test-extension-0.0.1-SNAPSHOT.jar!/META-INF/services/javax.enterprise.inject.spi.Extension@1[test.extension.CdiExtension@ed791f]]]
          at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:314)
          at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
          at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
          at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
          at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
          at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
          at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
          at com.oracle.injection.provider.weld.WeldInjectionContainer.start(WeldInjectionContainer.java:106)
          at com.oracle.injection.integration.CDIAppDeploymentExtension.initCdi(CDIAppDeploymentExtension.java:70)
          at com.oracle.injection.integration.CDIAppDeploymentExtension.activate(CDIAppDeploymentExtension.java:47)
          at weblogic.application.internal.flow.AppDeploymentExtensionFlow.activate(AppDeploymentExtensionFlow.java:37)
          at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
          at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
          at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
          at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
          at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
          at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
      ...
      

       

      Problem can be easily reproduced by a minimal case:

      test.ear:

      \lib\test-extension-0.0.1-SNAPSHOT.jar

      test-ejb-0.0.1-SNAPSHOT.jar

       

      where

      test-extension-0.0.1-SNAPSHOT.jar contains:

      CdiExtension.java:

      package test.extension;
      import javax.enterprise.inject.spi.Extension;
      public class CdiExtension implements Extension {
          private String someString = "Some String";
          public String getSomeString() {
              return someString;
          }
      }
      

      Bean1.java:

      package test.extension;
      import javax.enterprise.context.ApplicationScoped;
      import javax.inject.Inject;
      
      @ApplicationScoped
      public class Bean1 {
          @Inject
          private CdiExtension extension;
      
          public String get() {
              return extension.getSomeString();
          }
      }
      

       

      test-ejb-0.0.1-SNAPSHOT.jar contains:

      EjbBean.java:

      package test;
      import test.extension.Bean1;
      import test.extension.CdiExtension;
      import javax.ejb.Stateless;
      import javax.inject.Inject;
      
      @Stateless
      public class EjbBean {
          @Inject
          private CdiExtension extension;
          @Inject
          private Bean1 bean1;
          
          public String getSomeString() {
              return extension.getSomeString() + "\n" + bean1.get();
          }
      }
      

       

      p.s. i seen same problem in community.oracle.com/thread/2577403 , but it happen in "war", not "ear", and seems successfully patched with patch №17424706