Status: Resolved (View Workflow)
Affects Version/s: None
Fix Version/s: None
BeanDeployer uses reflection to find declared members of classes. When any member's class is missing from the classpath, a ClassNotFoundException is thrown by Class.getDeclaredXxx(). Weld catches this exception and ignores the class (no bean of that type will be registered) - see
While ignoring external classes (such as described in
WELD-644) is ok, the fix introduces a new problem.
Consider the following observer:
If MissingBean is missing from the classpath, Weld will ignore VeryImportantObserver.
The effect is that VeryImportantObserver will not be invoked. For non-observer beans, this isn't a big problem, since you usually inject the bean into some other bean and Weld will throw an Unsatisfied dependencies exception. For observers that are not injected into anything, no such exception will be thrown. The observer will simply be ignored quietly (well actually, a single log line (with log level INFO, not WARN!) will be printed in the log, but this is definitely not loud enough).
According to the spec, these kinds of cases should not be ignored at all:
The container must validate all injection points of all enabled beans, all observer methods, all disposer methods and all other Java EE component classes supporting injection when the application is initialized to ensure that there are no unsatisfied or unresolvable ambiguous dependencies.