13 Replies Latest reply: Apr 12, 2012 12:45 PM by Ken Finnigan RSS

Resolving unsatisfied dependencies for type [ServletExtension]

Sam Corbett Newbie

Hey, wondered if somebody could help me resolve an error I'm getting when deploying my application to AS 7.

 

I have dependencies on solder-api 3.1.0-FINAL (compile), solder-impl 3.1.0-FINAL (runtime) and servlet-api v2.5 in javax.servlet.  I'm using Weld 1.1.6-SNAPSHOT and AS 7.1.0. Deployment of my jar fails with these four errors:

 

WELD-001408 Unsatisfied dependencies for type [ServletExtension] with qualifiers [@Default] at injection point [[parameter 2] of [method] @Produces @TypedParamValue protected org.jboss.solder.servlet.http.RequestParamProducer.getTypedParamValue(InjectionPoint, ServletExtension)]

WELD-001408 Unsatisfied dependencies for type [ServletExtension] with qualifiers [@Default] at injection point [[parameter 2] of [method] @Produces @TypedParamValue protected org.jboss.solder.servlet.http.CookieParamProducer.getTypedParamValue(InjectionPoint, ServletExtension)]

WELD-001408 Unsatisfied dependencies for type [ServletLogger] with qualifiers [@Default] at injection point [[field] @Inject @Category private org.jboss.solder.servlet.event.ImplicitServletObjectsHolder.log]

WELD-001408 Unsatisfied dependencies for type [ServletExtension] with qualifiers [@Default] at injection point [[parameter 2] of [method] @Produces @TypedParamValue protected org.jboss.solder.servlet.http.HeaderParamProducer.getTypedParamValue(InjectionPoint, ServletExtension)]

 

The jar I'm deploying has been shaded to contain all dependencies, and it contains the two classes ServletExtension and ServletLogger.

 

Does anybody know why Weld is throwing these exceptions and what I can do to resolve them?

 

Thanks,

 

Sam.

 

 

The full exceptions are:

 

16:21:04,903 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"ezbrokerage-cdi-4.0.0-SNAPSHOT-with-dependencies.jar\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ezbrokerage-cdi-4.0.0-SNAPSHOT-with-dependencies.jar\".WeldService: org.jboss.weld.exceptions.DeploymentException: Exception List with 4 exceptions:

Exception 0 :

org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ServletExtension] with qualifiers [@Default] at injection point [[parameter 2] of [method] @Produces @TypedParamValue protected org.jboss.solder.servlet.http.RequestParamProducer.getTypedParamValue(InjectionPoint, ServletExtension)]

          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.Validator.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)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

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

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

          at java.lang.Thread.run(Thread.java:680)

Exception 0 :

org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ServletExtension] with qualifiers [@Default] at injection point [[parameter 2] of [method] @Produces @TypedParamValue protected org.jboss.solder.servlet.http.CookieParamProducer.getTypedParamValue(InjectionPoint, ServletExtension)]

          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.Validator.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)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

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

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

          at java.lang.Thread.run(Thread.java:680)

Exception 0 :

org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ServletLogger] with qualifiers [@Default] at injection point [[field] @Inject @Category private org.jboss.solder.servlet.event.ImplicitServletObjectsHolder.log]

          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.Validator.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)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

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

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

          at java.lang.Thread.run(Thread.java:680)

Exception 0 :

org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ServletExtension] with qualifiers [@Default] at injection point [[parameter 2] of [method] @Produces @TypedParamValue protected org.jboss.solder.servlet.http.HeaderParamProducer.getTypedParamValue(InjectionPoint, ServletExtension)]

          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.Validator.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)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

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

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

          at java.lang.Thread.run(Thread.java:680)

"}}}}


  • 1. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    Jason Porter Master

    Do you have two versions of Solder?

  • 2. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    Sam Corbett Newbie

    No, just 3.1.0.Final.

     

    Wouldn't two versions of Solder give an error about ambiguous dependencies, rather than unsatisfied dependencies?

     

    I wondered if this was related to https://issues.jboss.org/browse/WELD-778, but I'm deploying a jar, not an ear.

  • 3. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    I'm having a similar problem:

     

    Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.jboss.solder.servlet.support.ServletLogger] is not found with the qualifiers

    Qualifiers: [@javax.enterprise.inject.Default()]

    for injection into

    Field Injection Point, field :  private org.jboss.solder.servlet.support.ServletLogger org.jboss.solder.servlet.event.ImplicitServletObjectsHolder.log, Bean Owner : [-1537609042,Name:null,WebBeans Type:MANAGED,API Types:[java.lang.Object,org.jboss.solder.servlet.event.ImplicitServletObjectsHolder],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]

                InjectionType   :  [interface org.jboss.solder.servlet.support.ServletLogger]

                Annotated             :  [Annotated Field,Base Type : interface org.jboss.solder.servlet.support.ServletLogger,Type Closures : [class java.lang.Object, interface org.jboss.solder.servlet.support.ServletLogger],Annotations : [@javax.inject.Inject(), @org.jboss.solder.logging.Category(value=solder-servlet)],Java Member Name : log]

                Qualifiers            :  [[@javax.enterprise.inject.Default()]]

              at org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92)

              at org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:96)

              at org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:189)

              at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1087)

              at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:388)

              at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:332)

              at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:183)

              at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:124)

              at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:78)

              at com.ibm.ws.webbeans.common.CommonLifeCycle.startApplication(CommonLifeCycle.java:106)

              at com.ibm.ws.webbeans.services.JCDIServletContainerInitializer.onStartup(JCDIServletContainerInitializer.java:85)

              at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:609)

              at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:405)

              at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)

              at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)

              ... 68 more

     

    I'm developing a JEE6 web application deployed on IBM Websphere 8. For this web application, I want to use Seam Faces.

    My pom.xml dependencies:

     

    <dependency>

      <groupId>org.jboss.seam.faces</groupId>

      <artifactId>seam-faces</artifactId>

      <version>3.1.0.Final</version>

    </dependency>

    <dependency>

      <groupId>org.jboss.seam.international</groupId>

      <artifactId>seam-international</artifactId>

      <version>3.1.0.Final</version>

    </dependency>

    <dependency>

      <groupId>org.jboss.solder</groupId>

      <artifactId>solder-impl</artifactId>

      <version>3.1.0.Final</version>

    </dependency>

     

    The stacktrace points to the class ImplicitServletObjectsHolder that has a field log of type ServletLogger. Which class from which jar/dependency does the required @Provides?

     

    Kind regards,

     

    Kris Vandebroek

  • 4. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    Jason Porter Master

    Do you have the JBoss Logging artifacts?

  • 5. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    Can you elaborate? Which artifact do you mean? Do you mean any of the artifacts within maven groupid org.jboss.logging, like jboss-logging?

    • If I look at the contents of jboss-logging-3.1.0.GA.jar this appears to be the same as solder-logging-3.1.0.Final.jar, only having a different package name.
    • The artifact I need must at least have a dependency on solder-impl, since this one contains the definition of the class org.jboss.solder.servlet.support.ServletLogger.

     

    Below you can find my dependency tree:

     

    [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ myproject-web ---

    [INFO] be.vv:myproject-web:war:1.0.0-SNAPSHOT

    [INFO] +- be.vv:myproject-rpg-domain:ejb:1.0.0-SNAPSHOT:compile

    [INFO] |  +- org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.3.2:compile

    [INFO] |  |  +- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.3.2:compile

    [INFO] |  |  \- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.3.2:compile

    [INFO] |  |     \- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.3.2:compile

    [INFO] |  \- org.apache.commons:commons-lang3:jar:3.1:compile

    [INFO] +- be.vv:myproject-domain:ejb:1.0.0-SNAPSHOT:compile

    [INFO] +- be.vv:myproject-service:ejb:1.0.0-SNAPSHOT:compile

    [INFO] +- javax.faces:javax.faces-api:jar:2.1:provided

    [INFO] +- javax:javaee-api:jar:6.0:provided

    [INFO] +- org.jboss.seam.faces:seam-faces:jar:3.1.0.Final:compile

    [INFO] |  +- org.jboss.seam.faces:seam-faces-api:jar:3.1.0.Final:compile

    [INFO] |  \- org.jboss.seam.international:seam-international-api:jar:3.1.0.Final:compile

    [INFO] +- org.jboss.seam.international:seam-international:jar:3.1.0.Final:compile

    [INFO] +- org.jboss.solder:solder-impl:jar:3.1.0.Final:compile

    [INFO] |  \- org.jboss.solder:solder-api:jar:3.1.0.Final:compile

    [INFO] |     \- org.jboss.solder:solder-logging:jar:3.1.0.Final:compile

    [INFO] +- org.primefaces:primefaces:jar:3.1.1:compile

    [INFO] \- org.primefaces.themes:home:jar:1.0.3:compile

  • 6. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    My invenstigation of this issue has lead me to http://docs.jboss.org/seam/3/latest/reference/en-US/html/solder-logging.html which describes that the actual implementation classes of the logger interfaces (like ServletLogger) are generated at compile-time by adding org.jboss.solder.solder-tooling as a maven dependency and setting Java compliance to 1.6.

     

    So I added:

     

    <dependency>

      <groupId>org.jboss.solder</groupId>

      <artifactId>solder-tooling</artifactId>

      <scope>provided</scope>

      <version>3.1.0.Final</version>

    </dependency>

     

    And:

     

    <build>

      <plugins>

        <plugin>

          <artifactId>maven-compiler-plugin</artifactId>

          <version>2.3.2</version>

          <configuration>

            <source>1.6</source>

            <target>1.6</target>

          </configuration>

        </plugin>

      </plugins>

    </build>

     

    Result: I'm still getting the error. I can't find any generated classes in my .ear/.war/.jar files.

    What can be the cause of this?

     

    Kind regards,

     

    Kris


  • 7. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    Ken Finnigan Master

    The ServletLogger generated class for logging is provided within the solder-impl.jar

     

    If you open up that jar file you can see class files with $ and locale information within the org.jboss.solder.servlet.support package

     

    I would also suggest trying your application with AS7, as it may be an issue related to Websphere v8 that is causing the problem.

  • 8. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    Ken,

     

    Thanks for your reply.

     

    Apparently Eclipse was hiding classes with a $-sign. I found ServletLogger_$logger.class in the Solder-Impl.jar.

     

    So, with those generated classes on my classpath, injection with CDI should work if and only if the class is recognized as a valid managed bean.

    Section 3.1.1 from the JSR299 CDI specification, one of the constraints are:

    It has an appropriate constructor - either: a) the class has a constructor with no parameter, or b) the class declares a constructor annotated @Inject.

     

    If I look at the generated class ServletLogger_$logger, this contains a non-default constructor and does not annotate it with @Inject:

     

    public ServletLogger_$logger(Logger log) {

      this.log = log;

    }

     

    This is causing the problem, I did following steps to derive it:

    • Create my own Logger and let jboss-tooling generated the implementation. If I attempt to wire the implementation, I get and error indicating CDI cannot find an implementation.
    • If I copy the generated source and put in my source files and deactivate the jboss-tooling, logically, I get the same error.
    • But if I add @Inject to the constructor, it works and CDI is finding and injecting the implementation.

     

    This leads to me suspect that the logging implementation classes generated by solder-tooling are not conform the CDI specification. (3.1.0-Final)

     

    Is this a know issue?

     

    Kind regards,

     

    Kris Vandebroek

  • 9. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    To be more specific:

    I use:

    • org.jboss.solder:solder-impl:3.1.0-Final
    • org.jboss.solder:solder-api: 3.1.0-Final
    • org.jboss.solder:solder-tooling:3.1.0-Final
    • org.jboss.solder:solder-logging:3.1.0-Final (inherited from solder-api)
    • org.jboss.logging:jboss-logging-generator:1.0.0.CR3.jar (inherited from solder-tooling)
  • 10. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    Ken Finnigan Master

    It's possible there's a bug in Solder Tooling, but if that was the case I believe there would be errors occuring in the testsuite for Solder, as it generates logging classes and uses them with CDI.

     

    One item from above that is missing in terms of how a logger is injected, is that we don't do a straight CDI injection from your injection point (ie. @Inject Logger) to the generated class file from tooling.  We have an extension and producer that generate the necessary CDI Injectable version of the Logger based on the generated class.  The classes I refer to are found here: https://github.com/seam/solder/tree/develop/impl/src/main/java/org/jboss/solder/logging

     

    A couple of other points, it would be good to narrow down whether your error is specific to running in OWB or possibly Websphere.  Can you try Weld on AS7 as a comparison?

     

    Regards

    Ken

  • 11. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    Thanks Ken for your reply.

     

    With respect for your suggestion to try on AS7: I'm working for a customer in a sandbox environment and so I can't install AS7 to do a test.

     

    But your hint on how the injection works, shone a bit of light on my problem allowing me to dig deeper. Here are my findings:

     

    • Extension org.jboss.solder.logging.TypedMessageLoggerExtension is registered in solder-impl-3.1.0-Final.jar/META-INF/services/javax.enterprise.inject.spi.Extension.
    • This extension does two things:
      • It observes / detects the different MessageLogger interfaces and keeps them in a Collection field.
      • For every detected interface, a bean in registered with the BeanManager so it can be used for injection.

     

    That explains how it should work, but why is it going wrong?

     

    What do I see with my debugger: 1) The MessageLoggers are successfully detected (including the ServletLogger), but 2) when he tries to register the beans, the Collection field is empty so no beans are registered. How is this possible? Aparently there are two instances of TypedMessageLoggerExtension in memory. One receives the ProcessAnnotatedType events and detects the different Loggers, the other one receives the AfterBeanDiscovery event and can register beans.

     

    I'm in the dark on why there are two instances created. Below I'll try to add the information I found while debugging, hoping this gives you enough information to detect the problem:

     

    Step 1: At loading time of the web application, the scanner services instantiates all extensions and creates instance 1

     

    step1_creationFirstInstance.png

     

    Step 2: With the first ProcessAnnotatedType event, instance 2 is created

     

    step2_creationSecondInstance.png

     

    Step 3: instance 2 is notified of all the Logger interfaces with @MessageLogger annotation. He stores the result in the object-field messageLoggerTypes.

     

    step3_detectedLoggersWithSecondInstance.png

     

    Step 4: instance 1 is notified of the AfterBeanDiscovery event. But since it is a different instance, he does not know the discovered Loggers. Result: no logger beans are registered in the BeanManager and thus I get javax.enterprise.inject.UnsatisfiedResolutionException.

     

    step4_createBeansWithFirstInstance.png

     

    Thanks for looking into this.

  • 12. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    pintail Newbie

    Meanwhile I was able to test the case on a JBoss AS 7 / Weld environment.

    Here the before mentioned problem does not occur. Weld creates only one instance of the TypedMessageLoggerExtension class.

     

    Seam Solder and more specific the TypedMessageLoggerExtension class assumes that only one instance is created. Is that assumption allowed / valid according to the specification?

    If so, does this indicate that OWB contains a bug? Do you know a workaround that could work for me?

    If not, Seam Solder should not make this assumption. If this is the case: we can update the issue I logged.

     

    Thanks for looking into this.

     

    Kris

  • 13. Re: Resolving unsatisfied dependencies for type [ServletExtension]
    Ken Finnigan Master

    Kris,

     

    I'm fairly certain that there should only be one instance of the Extension within CDI.

     

    As Weld works, I see it as two possible scenarios:

    1) Weld has it right and there is a bug in OWB

    2) Weld and OWB are both right, but because of the CDI 1.0 spec being vague about how to handle this situation.

     

    Best course of action is probably to speak with the OWB guys to see if they have come across this problem before.

     

    Ken