Does EJB container reside in all application servers. EJB container in depth
Asked Answered
F

2

9

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.

Fluctuation answered 29/2, 2012 at 7:19 Comment(1)
Your 2nd question is incomplete !Concur
C
10

To answer your questions

  1. Generally yes. Application server is generally referred to a server with has EJB container like Glassfish, Jboss etc. But you need make sure that the application server has EJB support.

  2. YES

  3. NO. Web servers or Web containers (Tomcat, Jetty etc ) serve a different purpose than EJB container. But all the application servers do have web servers (along with EJB containers. ).

The EJB container and web container (servers) server are different layers in a Java EE application scenario . Check this link for more info.

Concur answered 29/2, 2012 at 7:28 Comment(2)
Thanks for the clarifications. What is the difference, in services provided by app server and web server ??Fluctuation
"Generally" A web server deals with UI part of application (what you see on browser) where as an app server is bigger and contains the web server EJB container (you business logic) and other enterprise services like JNDI, Datasource, transaction etc.Concur
S
14

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.

Semiyearly answered 29/2, 2012 at 8:59 Comment(5)
So ambiguity in naming an application server, is present, and web servers are subset of app servers. Got it !!! Thank you.Fluctuation
Right. If someone wants, he can write his application code in JavaScript or CGI scripts, embed those within web server and call it application server. It's always important to use the shared vocabulary to be sure what are you talking about :-)Semiyearly
In an enterprise set-up, you will often have a web-server 'in front of' the app-server, because the web-server will be optimised to handle large numbers of http requests, before passing the request to the application server (to generate the actual content)Saucedo
@Matt sure! That's what I was trying to say in the second bullet point from answer no. 2.Semiyearly
One extra remark to your good answer: the Java EE web profile includes EJB, but a special version of it called EJB Lite.Gratuity
C
10

To answer your questions

  1. Generally yes. Application server is generally referred to a server with has EJB container like Glassfish, Jboss etc. But you need make sure that the application server has EJB support.

  2. YES

  3. NO. Web servers or Web containers (Tomcat, Jetty etc ) serve a different purpose than EJB container. But all the application servers do have web servers (along with EJB containers. ).

The EJB container and web container (servers) server are different layers in a Java EE application scenario . Check this link for more info.

Concur answered 29/2, 2012 at 7:28 Comment(2)
Thanks for the clarifications. What is the difference, in services provided by app server and web server ??Fluctuation
"Generally" A web server deals with UI part of application (what you see on browser) where as an app server is bigger and contains the web server EJB container (you business logic) and other enterprise services like JNDI, Datasource, transaction etc.Concur

© 2022 - 2024 — McMap. All rights reserved.