Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
923 views
in Technique[技术] by (71.8m points)

maven - org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type Bean with qualifiers @Default

My project was working fine yesterday. The only thing I did was to change the structure from a single war to a multi module pom. If I understand correctly the stacktrace there is ambiguousity between weld and omnifaces websocket lib. However there doesn't seem to be any call to any of my methods on the stacktrace. So maybe it's a problem with omnifaces ? I don't even use omnifaces websockets, I use javax.websocket. I did however try it out in this project in the past, and I did a search on "org.omnifaces.cdi" and commented out things from sub packages like @Param but the problem remains. Also I don't understand why the ambiguousity seem to be from the 2 exact same classes:

  • Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default],
  • Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default]
[2016-06-25 03:13:59,430] Artifact core:war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."core-0.0.1-SNAPSHOT.war".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit."core-0.0.1-SNAPSHOT.war".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 4 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions
  at org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions(SocketPushContextProducer.java:0)
  Possible dependencies: 
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default],
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default]

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:367)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private org.omnifaces.cdi.push.SocketChannelManager.socketSessions
  at org.omnifaces.cdi.push.SocketChannelManager.socketSessions(SocketChannelManager.java:0)
  Possible dependencies: 
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default],
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default]

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:367)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketUserManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private org.omnifaces.cdi.push.SocketSessionManager.socketUsers
  at org.omnifaces.cdi.push.SocketSessionManager.socketUsers(SocketSessionManager.java:0)
  Possible dependencies: 
  - Managed Bean [class org.omnifaces.cdi.push.SocketUserManager] with qualifiers [@Any @Default],
  - Managed Bean [class org.omnifaces.cdi.push.SocketUserManager] with qualifiers [@Any @Default]

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:367)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Exception 0 :
org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318: Cannot resolve an ambiguous dependency between: 
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default],
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default]
    at org.jboss.weld.manager.BeanManagerImpl.resolve(BeanManagerImpl.java:1235)
    at org.jboss.weld.bootstrap.Validator.validatePseudoScopedInjectionPoint(Validator.java:926)
    at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:902)
    at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:917)
    at org.jboss.weld.bootstrap.Validator.validatePseudoScopedBean(Validator.java:879)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:138)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
"}}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions

Basically, Weld discovered multiple CDI managed beans which could be injected in private SocketSessionManager socketSessions field of the SocketPushContextProducer class. They are listed thereafter:

Possible dependencies:

  • Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default]
  • Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default]

In this specific case they are however exactly the same. This means that there are multiple SocketSessionManager classes in the runtime classpath. This in turn means that there are multiple OmniFaces libraries/dependencies present in the runtime classpath (or a dirty build/(hot)deploy which could be solved by trashing server's work/temp folders or spawning a clean server instance).

You need to make sure that there's only one OmniFaces library in the runtime classpath and that it ends up in WAR's /WEB-INF/lib.

This is not specifically related to websockets. It just happened to be the first OmniFaces-related class which is scanned by Weld. It could occur on any other CDI managed bean bundled in OmniFaces.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...