Details
-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Major
-
Resolution:
Won't Fix
-
Affects Version/s: 1.0.1.Final
-
Fix Version/s: TBC
-
Component/s: Java SE Support
-
Labels:None
-
Environment:Java 6 + WeldSE
-
Steps to Reproduce:
-
Workaround Description:
Description
The class org.jboss.weld.environment.se.threading.RunnableDecorator incorrectly assumes that there will be at least one bean that implements Runnable.
If there are no beans that implements Runnable then an error like this will happen:
org.jboss.weld.DeploymentException: Injection point has unstatisfied dependencies. Injection point: field org.jboss.weld.environment.se.threading.RunnableDecorator.runnable; Qualifiers: [@javax.enterprise.inject.Default()]
at org.jboss.weld.Validator.validateInjectionPoint(Validator.java:232)
at org.jboss.weld.Validator.validateBean(Validator.java:80)
at org.jboss.weld.Validator.validateRIBean(Validator.java:100)
at org.jboss.weld.Validator.validateBeans(Validator.java:282)
at org.jboss.weld.Validator.validateDeployment(Validator.java:267)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:389)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:81)
at org.jboss.weld.environment.se.StartMain.go(StartMain.java:45)
at org.jboss.weld.environment.se.StartMain.main(StartMain.java:57)
I guess the field "runnable" inside this class should be changed to use Instance<Runnable> instead.
Hi Morten,
I like your suggestion to use Instance<Runnable>, and will likely end up taking that on board as an additional barrier against users experiencing this exception. However I first want to understand why you are experiencing this exception at all.
In my experience, since RunnableDecorator is a decorator, then unless it is enabled as a decorator in beans.xml it shouldn't be a target for injection at all, unless you are instantiating it some other way. I've just done a test which demonstrates this, which I'll attach. Try running the project (most easily done in NetBeans since that's where it was created, but also possible from the command line with some maven building and manual classpath wizardry) with the decorator enabled versus commented out.
I don't suppose you have the decorator enabled in your beans.xml?
Are you causing RunnableDecorator to be instantiated any other way? Injecting it somewhere perhaps?
Otherwise, what am I missing?
Thanks for your feedback.