I googled with no luck trying to understand why Weblogic 10.3.4 does not inject EJB into the annotated field in the servlet.
The ear contains ejb.jar defining the DAO EJB and web.war with TestServlet.
PluginDataDAO.java
@Stateless public class PluginDataDAO implements IPluginDataDAO { }
IPluginDataDAO.java
@Local public interface IPluginDataDAO { }
TestServlet.java
public class TestServlet extends HttpServlet { @EJB(mappedName = "PluginDataDAO") private IPluginDataDAO pluginDataDAO; }
web.xml
<web-app version="2.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"> <servlet> <servlet-name>TestServlet</servlet-name> <servlet-class>cz.literak.blog.j2ee.TestServlet</servlet-class> </servlet>
The servlet is inside web.war, EJB in ejb.jar. I tried annotation with / without a mapped name attribute with no luck. When I tried to upgrade web.xml to 3.0, the deployment failed because 3.0 was not listed. What's wrong? Why is pluginDataDAO still null? Thanks.
java dependency-injection servlets ejb weblogic
Leos literak
source share