Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Clarifications on Application server and Servlet container  RSS feed

 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

From several days I'm trying to understand the real differences between Tomcat and Glassfish, I state that up to now I have always used php and Java + Tomcat and I think that this limits the way I see the web app, but could change with the understanding of Application server working.
From what I read GlassFish is an application server, and not a simple servlet container.

Using Tomcat I structured my app using the MVC pattern, and in a single WAR file I will put the client side code (such as html,js,css) and the business code (such as Java classes).
The app is divided in 2:
1. The former contain the engine that generates the html pages which client can request, and the APIs used like a bridge between the client side interface and business code into server.
2. While the latter is the business code of application.

The APIs are developed extending the HttpServlet class, and works as:

For developing a real enterprise application this architecture is well formed?

If the answer is yes, then what is the real difference between application server and servlet container (EE) considering the fact that you can import all EE libraries into the application and can be run on tomcat in the same way of Glassfish or other application server.
Why an application server is better than servlet container?

Thank you all, I hope that I been enough clear, thanks again for your time bye.
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

A servlet-container supports only the servlet API (including JSP, JSTL).

An application server supports the whole JavaEE - EJB, JMS, CDI, JTA, Servlets, etc.

It is possible to run most of the JavaEE technologies on a servlet-container, but you have to install a standalone implementation of the particular technology.
 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and thanks for response,

To simplify my understanding I focus only to EJB.
There are some articles that explain the EJB but I can't find one that explain correctly.
The servlet is used for http communication (like client <--> server), the EJB is used in other architecture (maybe server <-> server)
Some articles describe the EJB like a bean that can be sent over the network.. other articles describe like a class that provides methods, over the network, using particular protocols..
Obviously I'm confused about that, can you explain what is EJB, and when must be used please?

(PS. this is why I can't understand the difference between application server and servlet container).
 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrea Catania wrote:

Obviously I'm confused about that, can you explain what is EJB, and when must be used please?



I will try to explain it simply :

EJB is a server side component which you are write your business logic (a class contains methods for a business logic for your application).
The client to this EJB can be local client (program run on the same JVM) , remote client (program run on another JVM) , java or non-java program , web service , .....

Any client type can get instance of this bean and call it's business methods.

EJB life cycle is managed by EJB container.
Any EE6 complaint application server is an EJB container - it also contains servlet container , .........
 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh.. Simply clear.

You know where can I read how it works in depth, and how it can be implemented?

At last, if I can ask for an advice, the architecture as explained above is it correct, or can be improved?

You helped me a lot... Thanks!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!