2 Replies Latest reply: Dec 25, 2013 7:02 PM by Kalyan Pasupuleti-Oracle RSS

    WebLogic 12.1.2 fails when injecting extension in jar into bean in same jar

    d7145c95-58d4-4f62-8681-5c71a2bef17e

      WebLogic 12.1.2 fails when deploying a web application that contains a jar in which an extension is injected into a bean that resides within that same jar. The following exception is thrown:

       

      "weblogic.management.DeploymentException: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [SampleExtension] with qualifiers [@Default] at injection point [[field] @Inject private test.ApplicationBean.extension]"
      weblogic.management.DeploymentException: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [SampleExtension] with qualifiers [@Default] at injection point [[field] @Inject private test.ApplicationBean.extension]
        at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:123)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:260)
        at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:48)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
        Truncated. see log file for complete stacktrace
      Caused By: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [SampleExtension] with qualifiers [@Default] at injection point [[field] @Inject private test.ApplicationBean.extension]
        at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
        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)
      

      The problem can be easily reproduced by a minimal case with the following structure:

       

      war-root

           WEB-INF

               beans.xml

               lib

                  somejar.jar


      And with somejar.jar having the following structure:


      test

          ApplicationBean.java

          SampleExtension.java

      META-INF

          services

              javax.enterprise.inject.spi.Extension

          beans.xml


      ApplicationBean can looks as follows:

       

      @Named
      @ApplicationScoped
      public class ApplicationBean {
      
          @Inject
          private SampleExtension extension;
          
          @Inject
          private BeanManager manager;
          
          public void myMethod() {
              System.out.println("Extension:" + extension + " Manager:" + manager);
          }
          
      }
      

       

      And SampleExtension can be:

       

      public class SampleExtension implements Extension {
      
          public void onBeanDiscovery(@Observes AfterBeanDiscovery beanDiscovery, BeanManager beanManager) {
              out.println("Extension called");
          }
      
      }  
      

       

      I published a minimal web application (as Maven multi-module project) that reproduces the case here: https://github.com/arjantijms/inject-extension

       

      This application runs fine on basically every other Java EE server (tried specifically JBoss EAP 6.1, GlassFish 4.0 and TomEE 1.5.2), but not on WebLogic 12.1.2.

       

      Note that I'm not really a WebLogic user. I'm an open source library writer who's trying to make our library (OmniFaces) to run on all Java EE implementations. This case is part of a functionality in our upcoming release.