users@glassfish.java.net

WELD-001308 Unable to resolve managed beans for Types when CDI injecting from a separate jar

From: janne postilista <jannepostilistat_at_gmail.com>
Date: Mon, 11 Oct 2010 13:13:39 +0300

Hi,

 I have a MDB which I am injecting some beans into using CDI. I try to
inject MyInjectedBean. MyInjectedBean comes from a separate JAR. I
have added proper beans.xml to this jar's META-INF.

Injecting beans from the same EJB jar works fine. I can also create
MyInjectedBean manually with new() so my MDB can access the classes.

My packet structure is this way:

app.ear
 - ejb.jar
 - some.jar

MDB is in ejb.jar and MyInjectedBean is inside some.jar

@MessageDriven
public class MyMdbBean implements MessageListener {
   ...
   @Inject
   private MyInjectedBean myBean;
   ...
}


[#|2010-10-05T11:14:19.098+0300|SEVERE|glassfish3.0.1|javax.enterprise.system.container.ejb.mdb.com.sun.ejb.containers|_ThreadID=42;_ThreadName=Thread-1;|org.jb
oss.weld.exceptions.UnsatisfiedResolutionException
org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308
Unable to resolve managed beans for Types: [class com.MyInjectedBean];
 Bindings: [@javax.enterprise.inject.Default()]
       at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:807)
       at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:793)
       at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:108)
       at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:790)
       at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:802)