tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afryer <apfr...@hotmail.com>
Subject collapsed ear ejb and web application load order
Date Thu, 21 Apr 2011 04:55:28 GMT
I have tomcat + openejb and am deploying a collapsed ear (war) file that has
2 jars in WEB-INF/lib for the JPA entities and Stateless Session EJBs.

I have just been trying to access one of the EJBs from my web application
and I wanted to put in a local ejb reference in my web.xml as follows...

<ejb-local-ref>
  	<ejb-ref-name>MyEjb</ejb-ref-name>
  	<local>com.acme.MyEjbLocal</local>
</ejb-local-ref>

When I put this in web.xml, tomcat always fails to start because it can't
resolve the ejb reference to an actual ejb.  To work around this, I created
a servlet and used the @EJB annotation instead.  Having read the "Getting
Things" page in the documentation
(http://openejb.apache.org/3.0/basics-getting-things.html), I think the
<ejb-local-ref> in web.xml should be identical to the @EJB annotation in a
servlet.  

I think what is going wrong is that the web.xml is being processed and the
context is being setup BEFORE openejb kicks in and creates the EJBs.  The
reason the servlet works is probably because the annotations are processed
AFTER openejb has created the EJBs (note this is only a guess on my part so
could be completely wrong).

In other words what I think is happening is this...

1/ tomcat looks at web.xml, initializes servlets and filters and resolves
resource and ejb references
2/ tomcat+openejb parses jar files in WEB-INF/lib to create ejbs
3/ tomcat+openejb annotation parser does dependency injection and creates
EJB references in the local context.

What I think should happen is 

1/ tomcat+openejb parses jar files in WEB-INF/lib to create ejbs
2/ tomcat looks at web.xml, initializes servlets and filters and resolves
resource and ejb references
3/ tomcat+openejb annotation parser does dependency injection and creates
EJB references in the local context.


--
View this message in context: http://openejb.979440.n4.nabble.com/collapsed-ear-ejb-and-web-application-load-order-tp3465111p3465111.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message