Simplified Guide To J2EE
Simplified Guide To J2EE
Java™ 2 Platform,
Enterprise Edition
Please send technical comments to: [email protected]
Please send business comments to: [email protected]
TRADEMARKS
Sun, Sun Microsystems, the Sun Logo, Java, JDBC, JavaBeans, Enterprise JavaBeans, JavaMail, JavaServer Pages, Java
Naming and Directory Interface, and Write Once, Run Anywhere are trademarks or registered trademarks of Sun
Microsystems, Inc. in the United States and other countries.
THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS.
CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE
INCORPORATED IN NEW EDITIONS OF THE DOCUMENT. SUN MICROSYSTEMS, INC. MAY MAKE
IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS
DOCUMENT AT ANY TIME.
Please
Recycle
Contents
Introduction 1-1
What Is the Java™ 2 Platform, Enterprise Edition? 1-1
J2EE Application Model 1-2
The Java Technology Foundation 1-3
Security 1-3
Contents iii
J2EE Reference Implementation 1-10
iv Java® 2 Platform, Enterprise Edition Technical Overview ( Sun Microsystems, Inc. Confidential )
Introduction
This document provides an introduction to the features and benefits of the Java 2
platform, Enterprise Edition.
Typically, applications that provide these services must combine existing enterprise
information systems (EIS) with new business functions that deliver services to a
broad range of users. These services need to be:
■ Highly available, to meet the needs of today’s global business environment.
■ Secure, to protect the privacy of users and the integrity of enterprise data.
■ Reliable and scalable, to insure that business transactions are accurately and
promptly processed.
1-1
The Java 2 platform, Enterprise Edition reduces the cost and complexity of
developing these multi-tier services, resulting in services that can be rapidly
deployed and easily enhanced as the enterprise responds to competitive pressures.
The Java 2 platform, Enterprise Edition (J2EE) achieves these benefits by defining a
standard architecture that is delivered as the following elements:
■ J2EE Application Programming Model - A standard programming model for
developing multi-tier, thin-client applications.
■ J2EE Platform - A standard platform for hosting J2EE applications, specified as a
set of required APIs and policies.
■ J2EE Compatibility Test Suite - A suite of compatibility tests for verifying that a
J2EE platform product is compatible with the J2EE platform standard.
■ J2EE Reference Implementation - A reference implementation for demonstrating
the capabilities of J2EE and for providing an operational definition of the J2EE
platform.
The following sections of this document describe each of these elements in greater
detail.
To better control and manage these applications, the business functions to support
these various users are conducted in the middle tier. The middle tier represents an
environment that is closely controlled by an enterprise’s information technology
department. The middle tier is typically run on dedicated server hardware and has
access to the full services of the enterprise.
J2EE applications often rely on the EIS-Tier to store the enterprise’s business-critical
data. This data and the systems that manage it are at the inner-core of the enterprise.
Client
Client Server business Server
logic
business
logic data Services data
Developing multi-tier services has been complicated by the need to develop both the
service’s business function and the more complex infrastructure code required to
access databases and other system resources. Because each multi-tier server product
had its own application model, it was difficult to hire and train an experienced
development staff. In addition, as service volume increased it was often necessary to
change the whole multi-tier infrastructure, resulting in major porting costs and
delays.
The J2EE application model partitions the work needed to implement a multi-tier
service into two parts: the business and presentation logic to be implemented by the
developer, and the standard system services provided by the J2EE platform. The
developer can rely on the platform to provide the solutions for the hard systems-
level problems of developing a middle-tier service.
The J2EE application model provides the benefits of Write Once, Run Anywhere™
portability and scalability for multi-tier applications. This standard model minimizes
the cost of developer training while providing the enterprise with a broad choice of
J2EE servers and development tools.
Introduction 1-3
The J2EE application model is a major step forward in simplifying and expediting
application development, by minimizing the complexity of building multi-tier
applications.
The application model also includes the JavaBeans™ component model. JavaBeans
components make it easy to componentize the Java technology-based code for
common functions, then customize and combine these components visually with
JavaBeans development tools.
Security
While other enterprise application models require platform-specific security
measures in each application, the J2EE platform’s security environment enables
security constraints to be defined at deployment time. By shielding applications
from the complexity of implementing security, the J2EE platform makes them
portable to a wide variety of security implementations.
The J2EE platform defines standard declarative access control rules to be defined by
the application programmer/assembler and interpreted when the application is
deployed on the enterprise platform. J2EE also requires platform vendors to supply
standard login mechanisms so applications do not have to incorporate these
mechanisms into their logic. The same program works in a variety of different
security environments without change to the source code.
business
logic
Web Enterprise
Client
EJB
Information
Services
User
Interface
JSP
Many J2EE services will be designed to support web browser clients. These services
interact with their clients via dynamically generated HTML pages and forms.
More sophisticated services will interact with their first-tier clients by directly
exchanging business data. Here, JSPs and Servlets are used to format this business
data in a way that is easy for J2EE clients to work with. These clients can be both
Java applets running in a web browser and Java technology-based programs.
It is important to note that security is a key part of all multi-tier services. In J2EE,
security is handled almost entirely by the platform and its administrators. In most
cases, neither the service nor its clients require developer-written security logic.
Introduction 1-5
HTML Page Based Clients
A service can be presented directly to a user’s web browser as dynamically
generated HTML pages. JavaServer Pages technology is an easy way to dynamically
compose these pages using a familiar scripting paradigm that combines HTML and
Java technology-based code, as shown in FIGURE 3. In some cases, a service may
require some fairly complex code. This can be handled by placing code in a
JavaBeans component and calling it from a JSP. A service can also be directly
programmed in the Java programming language using a servlet.
Middle Tier
business
logic
Web Client EJB
HTML/Forms User
Interface
JSP
Typically this XML content is handled in the first-tier by JavaBeans components that
are provided by the service in an applet that is automatically downloaded into a
user’s browser, as shown in FIGURE 4. To avoid problems caused by old or non-
standard versions of the Java runtime environment in a user’s browser, the J2EE
application model provides special support for automatically downloading and
installing the Java Plug-in, Sun’s Java runtime environment that can be dynamically
loaded into the most popular browsers. This content can also be handled by a Java
Middle Tier
Browser
EJB
Applet
Bean
JSP/
Bean Servlet
Java
Intranet Clients
Both HTML page based services and HTTP content based services can be effectively
used on an enterprise’s intranet as well as the Internet.
In addition, the intranet provides the extra infrastructure that allows Java programs
to directly access EJBs within the intranet domain.
In conjunction with J2EE, Sun will provide white papers and technology
demonstrations that illustrate techniques for integrating Microsoft COM objects with
EJBs using RMI-IIOP. These will cover how to access EJBs from first-tier clients such
as Visual Basic and Windows 2000 via COM, as well as using EJBs in combination
with middle-tier functions implemented in Microsoft Transaction Server.
Introduction 1-7
The Enterprise Information Systems
A service’s middle-tier business functions must access and update the information in
the EIS-tier.
The following standard Java service APIs provide basic access to these systems:
■ JDBC™ - the standard API for accessing relational data from Java.
■ Java Naming and Directory Interface™ (JNDI) - the standard API for accessing
information in enterprise name and directory services.
■ Java™ Message Service (JMS)1 - the standard API for sending and receiving
messages via enterprise messaging systems like IBM MQ Series and TIBCO
Rendezvous.
■ JavaMail™ - the standard API for sending E-mail.
■ JavaIDL - the standard API for calling CORBA services.
J2EE Declarations
An important goal of the J2EE application model is to minimize application
programming.
One of the ways that this is accomplished is to shift the burden of implementing
common tasks to the J2EE platform. These common tasks include enforcing an
application’s security roles, implementing its transaction semantics, and linking its
components to the resources and other components they require.
J2EE Platform
The J2EE platform is the standard environment for running J2EE applications. The
J2EE platform is composed of the following elements:
■ J2EE deployment specification - a standard that defines a common way of
packaging applications for deployment on any J2EE compatible platform.
1. JMS is not required for J2EE 1.0; however, it will be made mandatory in a later release.
The J2EE platform defines the rich set of facilities that are needed to implement
enterprise-class, multi-tier services. The J2EE platform is based on proven, open
standards to deliver the broadest adoption and highest level of portability.
Once a J2EE unit has been produced, it is ready to be deployed to a J2EE platform,
as shown in FIGURE 5.
deploy.xml
EJB Security
Deployment ACLs
JSP Tool RunAs
Roles
HTML
Install
Servlet Components
Set
Applet
Transaction attributes
Introduction 1-9
Java Technology Standards for the J2EE Platform
The primary element of the J2EE platform is the list of Java technology standards
that all J2EE products are required to support.
The Java programming language, having grown up with IETF standards, has
become the preferred way of writing applications for them. The J2EE application
model and the J2EE platform continue this trend. In its current iteration, the J2EE
platform supports HTML and HTTP clients, and can support XML clients. In
addition, J2EE deployment descriptors make use of XML to provide application
information in a platform-independent way. Future versions of the J2EE platform
will likely define greater integration of XML for communicating data between tiers,
thus further enhancing portability of J2EE applications.
The EJB specification uses the application mapping for RMI-IIOP as its standard for
calling EJBs. The J2EE platform strongly supports the use of RMI-IIOP. Sun is
working closely with the other OMG members on future directions involving EJB
technology and CORBA.
Licensees will deploy, configure, and run this test suite (via its GUI framework) on
their platform implementations. The suite will include tests for ensuring that the
J2EE APIs are implemented. The tests will verify that the J2EE component
technologies are available and working together properly. It will also include a set of
fully functional J2EE applications to verify that all platforms are capable of
deploying and running them consistently.
Its primary role is as an operational definition of the J2EE platform. In this role, it is
used by vendors as the J2EE platform’s “gold standard” to determine what their
implementation must do under a particular set of application circumstances. It is
also used by developers to verify the portability of an application. Most importantly,
it is used as the standard platform for running the J2EE Compatibility Test Suite.
A secondary, but more visible, role for the reference implementation is as a freely
available platform for popularizing Java 2 platform, Enterprise Edition. Although it
is not a commercial product and its licensing terms will prohibit its commercial use,
it will be freely available in binary form for demonstrations, prototyping and
academic research.
Introduction 1-11
1-12 Simplified Guide to J2EE • Sept, 1999
J2EE Application Example:
A Web Store
The Java™ 2 Platform, Enterprise Edition can be used to build a wide range of
services. This section describes how the J2EE platform was used to create a web
store—CHEAPBOOKS.COM. As the example shows, the middle-tier of the J2EE
platform provides the complete foundation upon which this service’s presentation,
business logic, and EIS access is built. FIGURE 1 illustrates the J2EE components that
were used to create the Web store sample application.
The most significant thing about this web store example is what is not illustrated.
The normal complexity you would expect to see is not here because it did not have
to be built by the developers of the store. Instead, the developers used the J2EE
platform’s built-in support for middle-tier development.
The J2EE application programming model guided the developers of the web store
through the development process. The model simplified their work by naturally
separating the components used for presenting the store (JSPs) from those that
implement the store’s business processes (EJBs). In both areas, the J2EE application
model allowed the developers to dedicate their time to the application details
specific to the business of managing a bookstore, while behind the scenes the J2EE
platform handled the application’s complex system and resource demands.
2-1
bean and let the J2EE platform handle connection management. Since EJB
technology makes it easy to combine multiple actions into a single transaction,
order-processing problems caused by partial failure of a purchase are avoided. This
reduces the need for customer service involvement and results in greater customer
satisfaction.
Since the J2EE platform provides back-office access APIs that are integrated as a
standard part of the platform, the store’s business functions were developed and
integrated with the company’s existing systems, all within one consistent
environment.
The productivity of the Java™ platform plus the sophisticated middle-tier facilities
provided by the J2EE platform significantly reduced the time to market: the elapsed
time required to get the online store operational. Because J2EE is an open standard,
the store developers were able to select the vendor and computing hardware that
best fit their needs for functionality, performance, and reliability. In addition, the
wide selection of development and content authoring tools that can be used with
J2EE gave the developers the flexibility they needed to build a highly competitive
store.
The internet economy dramatically reduces the cost of switching from one vendor to
another for goods and services. E-commerce vendors who lock themselves into
single-platform solutions today may be restricting their ability to respond quickly to
changes in the market tomorrow. By applying the J2EE platform to their e-commerce
needs, organizations give themselves additional flexibility for maintaining and
building market share.
The middle-tier architecture needed to implement the web store is very similar to
the architecture needed to implement a wide range of services that directly reach the
important wide range of customers, employees, partners and suppliers that an
enterprise in today’s world must directly and efficiently interact with. Typical
examples of these services are customer management, supply chain management,
and employee expense accounting.
Customize Membership
H
T
T
P Browse Catalog
J
Database
D
H B
CUSTOMER T Select C
T
P Shopping Book
Secure
Cart Order
S
Purchase
Order
Acknowledgment
Acknowledge
Order
ISP
JavaMail
Mail Server