Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does EJB container reside in all application servers. EJB container in depth

I am newbie to EJB's. From all the reading and searching I have done till now, I understood the following:

  • EJB are the beans in which an applications business logic is written and maintained.
  • All EJB's are put into something called EJB container.
  • EJB container is nothing but a server side program written in order to manage EJB's, and to provide basic functionalities which are meant to be provided by EJB(viz, transaction management, security, collision free envt, etc).

1) My doubt is, does the so called EJB component reside in all application servers?

2) When we say EJB 2.1/3.0/3.1, does it mean that the new version of EJB container has been released?

3) Does the EJB container reside in web servers too?

Thank you.

like image 441
Anuj Balan Avatar asked Feb 29 '12 07:02

Anuj Balan


1 Answers

You understood the EJB idea correctly.

  1. Yes and no. Depends on what you understand as "Application server" (ambiguity described below in answer 3.)

  2. When you say EJB 2.x/3.0/3.1 or so on, you're referring to a particular EJB specification which means that you're referring to a set of services this version supports. In other words - yes, it means that the EJB container must be in a given version.
    First the specification is released (you can see the draft versions, vote for new features and basically participate in this process). Then, a reference implementation (RI) is written just to show that it's "doable" and you can use it right away. Then, different vendors might provide their own EJB containers which must conform to the particular EJB specification.

  3. There are few different terms you need to be aware of. Just to be sure, we're talking about the same things:

    • Web server is a HTTP/HTTPS server like Apache HTTP Server which serves clients requests. This term is not only related with Java EE.
    • Web container is a Java EE term which can mean few things, but usually it refers to Servlet container and, let's say JSP container. Those containers are serving web clients, so that's why it's web container. Generally, web container have a web server within it (like in the case of Tomcat.) However, you can configure it so that the static resources will be server by only pure web server while dynamic content (your Java App, Servlets, JSP, etc.) will be server by your web container.
    • Application server is a vague name. In Java EE purists world it can mean only such server that provides all the Java EE services. Non-Java EE purists treats Application server just as an arbitrary server which consists of your application. According to this definition, you can call Tomcat (a web container and web server) an application server.

As you see, the vocabulary is not sharp, as one thing might mean few slightly different things. Moreover, since Java EE 6 we have profiles. This means that you can have Java EE Application Server conforming to the Web Profile or Full Profile. In such terms, just the Web Profile server should be treated as an application server.

Just as a summary - you can use EJB Container in Web Container. Take a look at OpenEJB or basically at project TomEE.

like image 100
Piotr Nowicki Avatar answered Oct 19 '22 15:10

Piotr Nowicki