Introduction To Java EE (J2EE)
Introduction To Java EE (J2EE)
Java EE (J2EE)
Session Objectives
Understanding the value propositions of
J2EE
Getting a big picture of J2EE architecture and
platform
Getting high-level exposure of APIs and
Technologies that constitute J2EE
You don't have to understand all the details
Understanding why J2EE can be used for as
a platform for development and deployment
of web services
Umesh Bellur
CSE, IITB
What is J2EE?
Umesh Bellur
CSE, IITB
Enterprise Computing
Challenges Key Products
Portability Technologies App Servers
Diverse J2SE™ Web Servers
Environments J2EE™ Components
Time-to-market JMS Databases
Core Competence Servlet Object to DB
Assembly JSP tools
Integration Connector
XML
Legacy
Data Systems
Binding
Databases
XSLT
Umesh Bellur TP Monitors
EIS Systems
CSE, IITB
What Is the J2EE?
Open and standard based platform for
developing, deploying and managing
n-tier, Web-enabled, server-centric, and
component-based enterprise applications
Umesh Bellur
CSE, IITB
The Java™ Platform
Umesh Bellur
CSE, IITB
The Java TM
Platform
Java 2 Platform Micro Edition
(J2METM )
Optional
Packages
Optional
Packages
Personal Personal
Java 2 Java 2 Basis Profile Profile
Enterprise Standard
Edition Edition Foundation Profile MIDP
(J2EE) (J2SE)
Java
CDC CLDC Card
APIs
CSE, IITB
Open and Standard Solution
Use "component and container" model in
which container provides system services in
a well-defined and as industry standard
Umesh Bellur
CSE, IITB
Why J2EE?
Umesh Bellur
CSE, IITB
Platform Value to Developers
Can use any J2EE implementation for development
and deployment
Use production-quality standard implementation which is free for
development/deployment
Use high-end commercial J2EE products for scalability and fault-
tolerance
CSE, IITB
Platform Value to Vendors
Vendors work together on specifications and
then compete in implementations
In the areas of Scalability, Performance,
Reliability, Availability, Management and
development tools, and so on
Freedom to innovate while maintaining the
portability of applications
Do not have create/maintain their own
proprietary APIs
Umesh Bellur
CSE, IITB
Platform Value to Business
Customers
Application portability
Umesh Bellur
CSE, IITB
J2EE APIs &
Technologies
Umesh Bellur
CSE, IITB
J2EE 1.4 APIs and
Technologies
J2SE 1.4 (improved) Servlet 2.4
CSE, IITB
Java EE 5
JAX-WS 2.0 & JSR 181
Java Persistence
EJB 3.0
JAXB 2.0
JavaSever Faces 1.2 – new to Platform
JSP 2.1 – Unification w/ JSF 1.2
StAX – Pull Parser – new to Platform
Umesh Bellur
CSE, IITB
Servlet &
JSP (JavaServer
Pages)
Umesh Bellur
CSE, IITB
What is a Servlet?
Java™ objects which extend the functionality
of a HTTP server
Dynamic contents generation
Better alternative to CGI, NSAPI, ISAPI, etc.
Efficient
Platform and server independent
Session management
Java-based
Umesh Bellur
CSE, IITB
Servlet vs. CGI
Request
RequestCGI1
CGI1 Child
Child for
for CGI1
CGI1
Request CGI
CGI
RequestCGI2
CGI2 Based Child
Based Childfor
for CGI2
CGI2
Webserver
Webserver
Request
RequestCGI1
CGI1 Child
Childfor
for CGI1
CGI1
Request
RequestServlet1
Servlet1 Servlet
Servlet Based
Based Webserver
Webserver
Request Servlet1
RequestServlet2
Servlet2 Servlet1
JVM
JVM
Request Servlet1 Servlet2
Servlet2
Umesh Bellur
CSE, IITB
What is JSP Technology?
Enables separation of business logic
from presentation
Presentation is in the form of HTML or
XML/XSLT
Business logic is implemented as Java Beans
or custom tags
Better maintainability, reusability
Extensible via custom tags
Builds on Servlet technology
Umesh Bellur
CSE, IITB
EJB
(Enterprise Java
Beans)
Umesh Bellur
CSE, IITB
What is EJB Technology?
A server-side component technology
Easy development and deployment of Java
technology-based application that are:
Transactional, distributed, multi-tier, portable,
scalable, secure, …
Umesh Bellur
CSE, IITB
Why EJB Technology?
● Leverages the benefits of component-model
on the server side
● Separates business logic from system code
− Container provides system services
● Provides framework for portable components
− Over different J2EE-compliant servers
− Over different operational environments
● Enables deployment-time configuration
− Deployment descriptor
Umesh Bellur
CSE, IITB
EJB Architecture
Umesh Bellur
CSE, IITB
Enterprise JavaBeans
Enterprise JavaBeans
Stateless Stateful
CSE, IITB
JMS
(Java Message
Service)
Umesh Bellur
CSE, IITB
Java Message Service (JMS)
Messaging systems (MOM) provide
De-coupled communication
Asynchronous communication
Plays a role of centralized post office
Benefits of Messaging systems
Flexible, Reliable, Scalable communication systems
Point-to-Point, Publish and Subscribe
JMS defines standard Java APIs to messaging
systems
Umesh Bellur
CSE, IITB
Connector
Architecture
Umesh Bellur
CSE, IITB
Connector Architecture
Defines standard API for integrating J2EE technology with
EIS systems
CICS, SAP, PeopleSoft, etc.
Umesh Bellur
CSE, IITB
m x n Problem Before
Connector Architecture
m n
App SAP
Server1
App
EIS
Server2 2
App EIS3
Server3
App EIS4
Server
Umesh Bellur
CSE, IITB
JAAS (Part of J2SE
1.4)
(Java Authentication &
Authorization Service)
Umesh Bellur
CSE, IITB
JAAS: Authentication
Pluggable authentication framework
Userid/password
Smartcard
Kerberos
Biometric
CSE, IITB
JAAS Pluggable Authentication
Umesh Bellur
CSE, IITB
Other J2EE APIs &
Technologies
Umesh Bellur
CSE, IITB
JNDI
Java Naming and Directory Interface
CSE, IITB
JDBC
Umesh Bellur
CSE, IITB
J2EE Management (JSR-77)
Management applications should be able to
discover and interpret the managed data of
any J2EE platform
Single management platform can manage
multiple J2EE servers from different vendors
Management protocol specifications ensure a
uniform view by SNMP and WBEM
management stations
Leverages JMX
Umesh Bellur
CSE, IITB
J2EE Deployment (JSR-88) - J2EE
1.4
Tools J2EE Platforms
Standard
IDEs Deployment API
(Universal Remote)
Vendor Deploy
Tools
Management
Umesh BellurTools
CSE, IITB
JMX
JMX API into Dynamic Deployment
the J2EE 1.4 platform
JMX
JMX
App
J2EE App Server
JMX defacto
Umesh Bellur
A single technology for the J2EE platform
CSE, IITB
J2EE is an End-to-End
Architecture
Umesh Bellur
CSE, IITB
The J2EE Platform
Architecture
B2B
Applications
Existing
Applications
B2C
Applications
Web
Services
CSE, IITB
N-tier J2EE Architecture
WebTier EJBTier
Umesh Bellur
CSE, IITB
J2EE
Component & Container
Architecture
Umesh Bellur
CSE, IITB
J2EE Containers &
Components
Applet Container Web Container EJB Container
J2SE
RMI/IIOP
JavaMail
RMI/IIOP
JavaMail
JDBC
JDBC
JMS
JNDI
JTA
JNDI
JMS
JTA
App Client Container
JAF JAF
App HTTP/
Client HTTPS
J2SE
RMI
RMI/IIOP
JDBC
JNDI
JMS
J2SE J2SE
Database
Umesh Bellur
CSE, IITB
Containers Components
Handle Handle
Concurrency
Presentation
Security
Business Logic
Availability
Scalability
Persistence
Transaction
Life-cycle
management
Management
Umesh Bellur
CSE, IITB
Containers & Components
Containers do their work invisibly
– No complicated APIs
– They control by interposition
Containers implement J2EE
– Look the same to components
– Vendors making the containers have great
freedom to innovate
Umesh Bellur
CSE, IITB
J2EE Application
Anatomies
Umesh Bellur
CSE, IITB
Possible J2EE Application
Anatomies
Web Server EJB Server
DB & EIS
Resources
Stand-alone
Umesh Bellur
CSE, IITB
J2EE Application Anatomies
●
4-tier J2EE applications
–
HTML client, JSP/Servlets, EJB, JDBC/Connector
●
3-tier J2EE applications
–
HTML client, JSP/Servlets, JDBC
●
3-tier J2EE applications
–
EJB standalone applications, EJB,
JDBC/Connector
●
B2B Enterprise applications
–
J2EE platform to J2EE platform through the
exchange of JMS or XML-based messages
Umesh Bellur
CSE, IITB
Which One to Use?
● Depends on several factors
− Requirements of applications
− Availability of EJB tier
− Availability of developer resource
Umesh Bellur
CSE, IITB
Assignment 3
Assignment 3 – Deadline Feb
5 Booking server
JMS Topic
Xaction. #
JSP1 SB1
Client
(Browser) Posting &
JSP2
Display server
MDB SB2
Umesh Bellur
CSE, IITB
Notes on Assignment
JSP 1 – takes in a a stock trade to do as input (Ticker symbol &
quantity)
Assume all trades are buys.
Invokes the SB
SB posts trade into a “Transactions” table (ID, Ticker symbol and
trade amount) and the transaction ID (Unique) into the queue.
The MDB gets notified from the queue and invokes the SB2
SB2 reads the transaction and adjusts the “Positions” table. (Ticker
symbol, Current position)
JSP2 is used to read the current positions.
Build a delay into the MDB.
Umesh Bellur
CSE, IITB