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

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.