What is the workflow for running and configuring the application when using Apache TomEE

I understand that Apache TomEE is a typical Tomcat installation with openejb as a web application.

I'm trying to understand how all these bootstraps are. I will try to ask a few questions asked:

  • Is it important to have the application launch order? Should openab run before my web application or vice versa, or does it not matter?
  • Regarding the previous question. How does an enterprise application register its beans with openb, or is it that openb browses the search for enterprise applications on the same server, for EJB?
  • At a very unprofessional level, how could they provide openb as an EJB container when it is another web application. (IIRC every webapp in Tomcat gets a different class path and cannot step on each other)

Any other important information.

+7
source share
1 answer

Integration is loaded through this line in conf/server.xml :

 <Listener className="org.apache.tomee.loader.OpenEJBListener" /> 

This happens immediately upon launch, before launching any applications. Libraries from the <tomcat-home>/webapps/openejb/lib are added to the Tomcat class loader, another listener is installed to participate in the deployment, and from now on, everything happens using events in the Tomcat life cycle. Tomcat emits several events when the application starts (deploys) and shuts down. Tomcat itself uses them to deploy servlets, and essentially integration is something more. Other sellers who include Tomcat also use these hooks. From this point of view, the integration is really quite boring :)

The only interesting twist is the addition of additional libraries to the war file. This is really only done to deliver and add additional libraries to your existing Tomcat installation as simple as possible (and as simple as possible to remove). All libraries from <tomcat-home>/webapps/openejb/lib can just as easily go to <tomcat-home>/lib . At this point, the only thing that may be required for the webapss/openejb/ war is the ability to invoke EJB via HTTP.

So the short answers are:

  • The order in which the application starts is irrelevant.
  • EJB deployment happens side by side with servlet deployment
  • Boxes are added to the System Tomcat class loader immediately after starting Tomcat

It is interesting to note that in another answer, Tomcat actually only launches two banks on the class path. Tomcat itself actually adds all banks from <tomcat-home>/lib/ automatically at startup. We basically do the same thing, only from <tomcat-home>/webapps/openejb/lib

I don’t think that we really tested moving the libraries to <tomcat-home>/lib/ and removing openejb webapp (which is called tomee.war in the next final version), but I will take a note to try this. It seems that it’s good to maintain or even do it by default. You can remove Tomcat manager and ROOT webapps, so it seems like a good idea to simplify uninstalling openejb.war.

+8
source

All Articles