Vous êtes sur la page 1sur 11

Glarimy

J2EE Architecture
Krishna Mohan Koyya, M.Tech, DBM, PMP., Technology Consultant and Corporate Trainer krishnamohan@koyya.com http://krishna-labs.blogspot.com 091 9731 4231 66

2008, Glarimy. All rights reserved.

Glarimy

Sometimes, a computer on a LAN wants to have communication with another computer a Local Area Network (LAN). Interconnecting computers form on another LAN in order for sharing data among them. The communication among computers on a LAN is governed by a set of rules called a protocol like Ethernet. The data among the computers on a LAN is exchanged in Protocol Data Units (PDUs). Computers on LAN find each other by their MAC addresses of NICs. Several organizations can have their own private LANs. Each of them have their own protocol.
Summary:
ON INTERNET, LIKE ON A LAN, COMPUTERS CAN COMMUNICATE WITH EACH OTHER. Computers on two LANs can communicate with each other by connecting the LANs through a Router.

Interconnecting LANs form a Wide Area Network (WAN). Internet is the largest WAN in the Sometimes, a is a can communicate with A computer computer world with millions of LANs wants to Two computers programmable have communication with another computer electronic computing device that internconnected. each other by connecting with each in order for sharing dataComputers on the internet find each processes data. among them. other by their Network Interface Cards other by their IP addresses. (NICs).

2008, Glarimy. All rights reserved.

Glarimy Hi, I am a host computer with IP address 204.34.78.9. I know, you are a human being and would like to call me with a name. You can also call me with the DNS name: www.onlinestore.com. I am hosting a server program and assigned the port number 8080 to it. You know, I can host more than one program and assign different ports to them. Hi, I am the server program. So, I service requests from clients. I can understand the protocol http. So, the client also should understand http. Clients can reach me at URL http://204.34.78.9:8080 or http://www.onlinestore:8080 I can handle more than one client simultaneously. Hi, I am a client program. I request one or more servers and receive responses from them. I use the protocol of the server that I connect with.

LAN or Internet

2008, Glarimy. All rights reserved.

Glarimy

Great. I got the response. I will open the PDU and find out what it is. Now, let me close the connection, as I do not need it anything more. Oh!. I have a response for this request. Thank God! Let me put the response in the PDU and send it back. Now, let me put my request in the PDU. And send the request through the connection. Fine. Now I got the PDU. And wait for the response from the server Let me open the PDU and find out whats the request. Let me send a request to the server. Oh!. Someone is connected to me. Oh, I need a connection to send the request, right? Let me connect to the server. Looks like he needs some help. Let me wait to see whats their request.

Connection
LAN or Internet Request Response

2008, Glarimy. All rights reserved.

Glarimy

The clients that speak HTTP are called Browsers. Internet Explorer, Mozilla Firefox, Google Chrome are such browsers. When you time http://www.rediff.com/news.html, the browser does the following: 1. It finds out the IP address of the host machine with the DNS name www.rediff.com 2. It connects to that host at port number 8080. 3. It sends a request for asking for news.html page to the port. 4. Once the servers responds, it shows up the page on the screen.
The servers that speak HTTP protocol are called as HTTP Servers. Apache, IIS are such HTTP servers. But, can change the port number, if needed. They listen on 8080 port. The adminyou know? This HTTP server does not give When a client asks for a page, the server does the following: user specific response. That means, if its a bank 1. It tries to locates the file on the hosts hard disk. server, it gives the same bank statement to every a response. 2. If it finds the file, it sends back file content as user. Thats bad. 3. If it does not find the file, it sends error response (like File Not Found).

Connection
LAN or Internet Request Response

2008, Glarimy. All rights reserved.

Glarimy

Dont bother. I am here to solve your problem. Hi, I am a Webserver. My name is Tomcat. Thanks Tomcat. You know, I am not just HTTP Server. I am more than that. Of Hi Guysmy friend Apache HTTP Server always comes with me. course, and Girls, I am Catalina. He I always live within Tomcat. takes care of his job of interacting with the clients & sending static HTML page What I responses. do? I I a then? Whatamdo Servlet Container. I host and manage Servlets. You know servlets? I understand the client request in more detail and I can get a dynamic HTML page generated They are small java programs with my other friend Catalina. that I run to generate HTML responses dynamically. When you give a will get different HTML page it a response for different users. Because of this, you request to Tomcat, he finds if as is a servlet request and passes it to me. figure out the appropriate few words. Let Ime invite Catalina to speak servlet for that request and execute it. The servlet produces a HTML page and I gives it back as the response. This response can be different for different users.

Connection
LAN or Internet Request Response

2008, Glarimy. All rights reserved.

Glarimy

Hi friends, I am a Java Developer. Let me explain the story from my side. I develop Servlets and drop them in the Tomcat. Catalina hosts those servlets. Servlet is a java program, though it Web Server in size. Middleware Tomcat is smaller with Because its a java program, Tomcat comes with JRE to run those programs. Other Also, I can write the servlets in such a way that they can use Databases. Java Classes Servlet Apache Container Also, why not other java classes? ServletsHTTP other java classes as well. uses Server I call these other java classes as Business Classes. DB All the business classes together form what I call a middleware. From my perspective, this is how the web server looks like.
Business Layer
JRE

User Interface Layer

2008, Glarimy. All rights reserved.

Persistence Layer

Operating System

J2EE Based 3-Tier Web Architecture


LAN or Internet Request Response

Connection

Glarimy

Wait! This is not the end of the story. So the problem of user specific, i.e. login specific dynamic page you think, writing servlets is If generation is solved. But, you know, whats the problem with the business classes? difficult for you, then you can For every web application, write JSP pages and give it to me. I will have to take care of security, persistence, multithreading, can convert theend etc. into JRE I resource pools JSP pages Wont it be great if that is also provided to us by some one else? Servlets on my own. So that I just focus on application rather than all these common issues? Operating System Relax! Is there any one to help me out? Connection
LAN or Internet Request Response

Middleware with Other Java Classes

Tomcat Web Server JSP to Servlet Compiler Servlet Container Apache HTTP Server

2008, Glarimy. All rights reserved.

Glarimy

Application Server Ok! Let me show how actually I look like. EJB Container Middleware Tomcat Web Server Hi, with JSP to Servlet Compiler Other I can help you. I am an Application Server. Java Classes Servlet JBoss, Websphere,Apache WebLogic are allan EJB container. I am Application Servers. Container HTTP I am more than just a web server. I can help you. Server I have a friend called EJB Container apart from common issues. I take care of Tomcat. With his help, I can solve your problems at care business logic level. You take the of actual project. Things I take care include JRE Security Transactions Operating System Resource Pools and etc

Connection
LAN or Internet Request Response

2008, Glarimy. All rights reserved.

Glarimy

In Nutshell
J2EE is a 3-tier expandable architecture
Client Tier
Interfaces with the user Interacts with the Business Tier through HTTP Protocol Browser is the most popular client Does the actual business processing Interacts with Client and Persistent tiers Take care of persisting business data Database is the most popular persisting medium

Business Tier

Persistence Tier

The J2EE technologies include


Servlets and JSP
Generates responses as HTML pages, dynamically Takes care of security, transaction support and etc in the middle tier They can be session beans, entity beans or message beans

EJB

The J2EE roles include


HTTP Servers
Experts in locating and sending back static html pages (Ex: Apache) Experts in mapping the requests to corresponding servlets/JSPs on the server (Ex: Tomcat) Experts in connecting EJBs with the servlets, JSPs or other clients. (Ex: JBoss)

Web Servers Application Servers

2008, Glarimy. All rights reserved.

Glarimy

Thank You

2008, Glarimy. All rights reserved.

Vous aimerez peut-être aussi