The integration is bootstrapped via this line in the conf/server.xml
:
<Listener className="org.apache.tomee.loader.OpenEJBListener" />
This happens immediately at startup before any applications are started. The libraries from the <tomcat-home>/webapps/openejb/lib
directory are added to the Tomcat system classloader, another listener is installed to participate in deployment and from then on out everything happens using events in the Tomcat lifecycle. Tomcat will issue several events at application startup (deploy) and shutdown. Tomcat itself uses them for deployment of servlets and essentially the integration is just more of the same. Other vendors that include Tomcat also use these hooks. From that perspective the integration is really quite boring :)
The only interesting twist is putting the extra libraries in a war file. That's really only done to make delivering the and adding the extra libraries to an existing Tomcat install as easy as possible (and as easy as possible to remove). All the libraries from <tomcat-home>/webapps/openejb/lib
could just as easily go right in <tomcat-home>/lib
. At which point, the only thing you might want the webapss/openejb/
war for is to be able to invoke EJBs over HTTP.
So the short answers are:
- Appliction startup order doesn't matter
- EJB Deployment happens side-by-side with Servlet deployment
- Jars are added to the Tomcat system classloader immediately on Tomcat itself starts up
Interesting thing to note in the other answer is that Tomcat actually starts up with only two jars in the classpath. Tomcat itself actually adds all the jars from <tomcat-home>/lib/
automatically at startup. We're basically doing the same thing, just from <tomcat-home>/webapps/openejb/lib
I don't think we've actually tested moving the libraries into <tomcat-home>/lib/
and deleting the openejb webapp (which is called tomee.war
in the coming final release), but I'll make a note to try that. Seems like a good thing to support or maybe even do by default. You can delete the Tomcat manager and ROOT webapps, so it seems like a good idea to make it easy to delete the openejb.war as well.