Java – Weblogic 10.3.1 gives ‘Dependency injection failure’ warning when publishing code

ejb-3.0javaweblogic-10.x

Weblogic 10.3.1 gives me a "Dependency injection failure" when I publish my code; the publish itself succeeds. I am working via Eclipse.

Basically I publish an ear with a web service aaa.MyWebServicePort that has a bean bbb.MyBean declared as local variable with the ejb 3.0 @EJB annotation. bbb.MyBean is also in the ear as well as a client project with the interfaces defined.

After publishing the web service works on the appserver and calls bbb.MyBean. So why the warning?

Details of the warning in the console window of Eclipse: Error creating bean with name 'aaa.MyWebServicePort': Initialization of bean failed; nested exception is […] BeanCreationException: Dependency injection failure: can't find the bean definition about class interface bbb.MyBean; nested exception is […] NoSuchBeanDefinitionException: No unique bean of type bbb.MyBean is defined: No beans of type bbb.MyBean;

Best Answer

There may be a couple of issues at work here. I'm getting a very similar error in just a straight servlet that is trying to load an ejb that isn't packaged in the same ear, I'm still trying to track that down. I also know that there is a difficulty when loading EJB v2.x that is supposed to be fixed in Weblogic 10.3.3. If you find anything please let me know, and I'll do the same. One thing I have noticed is that if I load the EJB via initialContext.lookup, it works fine.

YMMV