When adding dependency: CDI deployment failure, Unsatisfied dependencies for type Set<Service> with qualifiers @Default

烈酒焚心 提交于 2019-11-29 15:23:08
mp911de

In Short:

Use a newer version of Guava.

Explanation

I guess, you have Guava 14 or 15 on your class path. The class com.google.common.util.concurrent.ServiceManager contains an @Inject expecting a Set of services. This dependency is not available, and the container raises a DeploymentException.

The solutions

  • Use a newer Guava version (at least 16, the fix was introduced there, see this commit)
  • Disable CDI
  • Implement a tiny producer

    @Produces Set<Service> dummyServices() {
      return new HashSet<>();
    }
    

Further docs:

Rashmi

Thanks for this solution. I am using Twilio SMS API which requires guava-14.0.1.jar as dependency. I was getting exception as

org.glassfish.deployment.common.deploymentexception: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]

I've upgraded the jar to guava-16.0.1.jar and it works.

Add the last version of Guava to your pom.xml file. That will solve your problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!