You are on page 1of 17

PLATFORM TECHNOLOGY

UNIT-5

Y3/S
5

1. Write in brief about the J2EE enterprise edition?


Java is one of the most commonly used and mature programming languages for building
enterprise applications.
Java development has evolved from small applets run on a Web browser to large enterprise
distributed applications run on multiple servers.
Now, Java has three different platforms, or flavors, and each addresses certain programming
requirements:
1.
2.

The Java 2 Platform, Standard Edition (J2SE)


The Java 2 Platform, Enterprise Edition (J2EE)

3.

The Java 2 Platform, Micro Edition (J2ME)

The Java 2 Platform, Standard Edition (J2SE)

It is the underlying base platform for the J2EE.


The J2SE platform consists of the Java 2 Software Development Kit (SDK) and the Java
2 Runtime Environment (JRE).

J2SE includes tools and application programming interfaces (APIs) for developing client
applications with graphical user interfaces (GUIs), database access, directory access,
Common Object Request Broker Architecture (CORBA), fine-grained security,
input/output functions, and many other functions. Its the most widely used Java
platform.

The Java 2 Platform, Micro Edition (J2ME)

It helps with building Java applications for micro-devices with limited display and
memory requirements (the entire API fits into 1KB), such as wireless devices, PDAs, and
network devices.

The Java 2 Platform, Enterprise Edition (J2EE)

It is a platform for building server-side components and applications.


It provides the infrastructure needed for these applications through a set of common
services.

The Java 2 Platform, Enterprise Edition (J2EE) defines the standard for developing
multitier enterprise applications.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 1

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

The J2EE platform simplifies enterprise applications by basing them on standardized,


modular components, by providing a complete set of services to those components, and
by handling many details of application behavior automatically, without complex
programming.

The J2EE platform takes advantage of many features of the Java 2 Platform, Standard
Edition (J2SE), such as "Write Once, Run Anywhere" portability, JDBC API for database
access, CORBA technology for interaction with existing enterprise resources, and a
security model that protects data even in internet applications.

Building on this base, the Java 2 Platform, Enterprise Edition adds full support for
Enterprise JavaBeans components, Java Servlets API, JavaServer Pages and XML
technology.

The J2EE standard includes complete specifications and compliance tests to ensure
portability of applications across the wide range of existing enterprise systems capable of
supporting the J2EE platform. In addition, the J2EE specification now ensures Web
services interoperability through support for the WS-I Basic Profile.

J2EE architecture supports component-based development of multi-tier enterprise


applications. A J2EE application system typically includes the following tiers:

Client tier: In the client tier, Web components, such as Servlets and JavaServer Pages
(JSPs), or standalone Java applications provide a dynamic interface to the middle tier.
Middle tier: In the server tier, or middle tier, enterprise beans and Web Services
encapsulate reusable, distributable business logic for the application. These server-tier
components are contained on a J2EE Application Server, which provides the platform for
these components to perform actions and store data.
Enterprise data tier: In the data tier, the enterprise's data is stored and persisted,
typically in a relational database.

J2EE applications are comprised of components, containers, and services. Components are
application-level components. Web components, such as Servlets and JSPs, provide dynamic
responses to requests from a Web page. EJB components contain server-side business logic for
enterprise applications. Web and EJB component containers host services that support Web and
EJB modules.
J2EE platform and its common services :

J2EE is a platform and an industry-accepted standard that enables solutions for


developing and deploying multitier enterprise applications.
It provides a unified platform for building distributed, server-centric systems.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 2

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

J2EE is a set of standard APIs that is offered by a vendor through products and tools to
be used by the enterprise.

It was developed to meet recent enterprise requirements, such as diversity of both


applications and data, in addition to the complexity of business processes.

The J2EE standard is defined through a set of related specifications, such as the J2EE
specification, the Enterprise JavaBeans specification, the Java Servlet specification, and
the JavaServer Pages (JSP) specification.

The J2EE platform offers the following benefits to the enterprise and to product vendors:

Establishes standards for database connectivity, Web components, business logic


components, message-oriented middleware (MOM), communication protocols, and
interoperability.
Decreases time-to-market because much of the infrastructure and common services are
provided by vendors products that are implemented according to the standard J2EE
specification.

IT organizations can get out of the middleware business and concentrate on building
applications for their business.

Increases developer productivity because Java programmers can relatively easily learn
J2EE technologies based on the Java language.

All enterprise software development can be accomplished under the J2EE platform, using
Java as the programming language.

Promotes interoperability within existing heterogeneous systems, such as CORBA and


J2EE.

Enables developers to focus on supporting business process requirements rather than


building the in-house application infrastructure. The application server handles the
complex tasks of multithreading, synchronization, transactions, resource allocation, and
life cycle management.

In general, the J2EE platform helps the enterprise to overcome certain issues such as
programming productivity, application reliability, availability, security, scalability, and
integration with existing systems.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 3

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

2. Explain the Java 2 Enterprise Edition Architecture

Sun released its J2EE specification which provided a comprehensive view of the Java
middle tier solution.

J2EE uses a 4-level model for web development.


The browser runs on the client displaying HTML and optionally runs
JavaScript.
The middle tier is comprised of two layers: a Presentation Layer and a
Business Logic Layer.
The data manages persistent data in a database and, where appropriate, legacy
data stores.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 4

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

J2EE implements the Presentation Layer with Servlets and, more recently, Java provides
the option to generate webpages with dynamic content using JavaServer Pages (JSP).
Servlets/JSP generate webpages with dynamic content (typically originating from the
database).

They also parse webpages submitted from the client and pass them to Enterprise
JavaBeans for handling. Servlets and JSPs run inside a Web Server.

J2EE implements the Business Logic layer with Enterprise JavaBeans (EJB). Enterprise
JavaBeans are responsible for logic like validation and calculations as well as provided
data access (e.g. database I/O) for the application. Enterprise JavaBeans run inside an
Application Sever.

Under J2EE, EJBs access a database through one of two means:


using a JDBC interface which requires a lower level of coding
using SQLJ which provides a higher level interface to the database
In addition to these components for web application, J2EE provides for access by nonweb clients to the business logic layer. A standalone Java application (IIOP client) can access
an EJB directly using J2EEs Remote Method Invocation (RMI) API.
The advantages of a 3-tiered or n-tiered application:
3-tier or multi-tier architectures force separation among presentation logic, business logic and
database logic. Let us look at some of the key benefits:

Manageability: Each tier can be monitored, tuned and upgraded independently and
different people can have clearly defined responsibilities.
Scalability: More hardware can be added and allows clustering (i.e. horizontal scaling).

Maintainability: Changes and upgrades can be performed without affecting other


components.

Availability: Clustering and load balancing can provide availability.

Extensibility: Additional features can be easily added.

Supporting J2EE APIs


J2EE provides a number of supporting APIs. The purpose of most of these APIs is to
enable interaction between the main software layers/components in the J2EE architecture.
RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 5

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

Remote Method Interface (RMI)


Java Servlets
JSP
EJB
Java Naming and Directory Interface (JNDI)
Java Message Service (JMS)
Java Transaction API (JTA)
Java Database Connectivity (JDBC) / SQLJ
JavaMail /JMC
JAAS
XML
Remote Method Interface (RMI)

RMI is an important API used for supporting distributed computing and has been
supported in core Java since version 1.1.

RMI allows a Java client application to communicate with a Java server application by
invoking methods on that remote object.

With RMI, the client gets a reference to a server object and then it can invoke methods on
that object as if it were a local object within the same virtual machine.

For server objects developed in other languages, you must employ other techniques like
using Java IDL with CORBA or RMI/IIOP to access the server object.

Java Servlets

Servlets are the Java platform technology of choice for extending and enhancing web
servers.

Servlets provide a component-based, platform-independent method for building webbased applications, without the performance limitations of CGI programs.

Servlets have access to the entire family of Java APIs, including the JDBCTM API to
access enterprise databases.

JSP (Java Server Pages)


RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 6

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

JavaServer Pages technology uses XML-like tags and scriptlets written in the Java
programming language to encapsulate the logic that generates the content for the page.

Any and all formatting (HTML or XML) tags are passed directly back to the response
page.

EJB (Enterprise Java Beans)

Enterprise JavaBeansTM is the server-side component architecture for the J2EETM


platform.

EJBTM enables rapid and simplified development of distributed, transactional, secure and
portable Java applications.

Java Naming and Directory Interface (JNDI)

JNDI allows Java programs to use name servers and directory servers to look up objects
or data by name. This important feature allows a client object to locate a remote server
object or data.

JNDI is a generic API that can work with any name or directory servers. Server providers
have been implemented for many common protocols (e.g. NIS, LDAP and NDS) and for
CORBA object registries. Of particular interest to users of J2EE, JNDI is used to locate
Enterprise JavaBean (EJB) components on the network.

Java Message Service (JMS)

JMS is an API for using networked messaging services. Data sent in a message is often
intended as a sort of event notification (e.g. a Email-handling process may need to be
notified when a request is enqueued).

Another common use for messaging (thus JMS) is for interfacing with external, third
party or legacy applications, typically via a Message Oriented Middleware product like
IBMs MQ Series (now WebSphere MQ).

It can be complex/risky to use RPC/RMI to directly invoke remote applications while a


messaging solution can provide a simpler and more reliable interconnection.

Java Transaction API (JTA)

JTA is used for managing distributed transactions (e.g. updates to multiple databases that
must be handled in a single transaction).

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 7

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

JTA is a low-level API and associated coding is complex and error-prone.

Fortunately, EJB containers (or application servers) generally provide support for
distributed transactions using JTA.

For this reason, the EJB developer is able to gain the benefit of distributed transaction
while leaving the complex implementation details to the provider of the EJB container.

Java Database Connectivity (JDBC) / SQLJ

In principle, JDBC serves the same purpose as ODBC. JDBC provides a databaseindependent protocol for accessing relational databases from Java.

JDBC supports Data Manipulation Language (DML) statements like insert, update,
delete, select. It also includes Data Definition Language (DDL) statements like Create
Table, Alter Table, etc.

JDBC was included in core Java starting with version 1.1. With JDBC, the SQL is always
dynamically generated at runtime and sent to the database.

An easier-to-use industry standard for Java database access has emerged and is
called SQLJ.

SQLJ allows static SQL to be used and it requires less cumbersome syntax than JDBC.

Other SQLJ advantages over JDBC include better code quality (due to compile-time
syntax checking) and better performance (due to compile-time optimization).

James Woodger co-authored an in-depth article on SQLJ for the November 2000 issue of
Java Enterprise Developer.

3. Write notes on the Multi-Tier Architecture


The J2EE platform uses a multitiered distributed application model. Application logic is
divided into components according to function, and the various application components that
make up a J2EE application are installed on different machines depending on the tier in the
multitiered J2EE environment to which the application component belongs. Client-tier
components run on the client machine.
J2EE multi-tiered applications are generally considered to be three-tiered applications
because they are distributed over three different locations
Client machines
RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 8

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

The J2EE server machine


The database or legacy machines at the back end

Multitiered Applications

Web-tier components run on the J2EE server.


Business-tier components run on the J2EE server.
Enterprise information system (EIS)-tier software runs on the EIS server.

Although a J2EE application can consist of the three or four tiers shown, J2EE
multitiered applications are generally considered to be three-tiered applications because they are
distributed over three different locations: client machines, the J2EE server machine, and the
database or legacy machines at the back end.
Three-tiered applications that run in this way extend the standard two-tiered client and
server model by placing a multithreaded application server between the client application and
back-end storage.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 9

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

J2EE Components
J2EE applications are made up of components. A J2EE component is a self-contained
functional software unit that is assembled into a J2EE application with its related classes and
files and that communicates with other components. The J2EE specification defines the
following J2EE components:
Application clients and applets are components that run on the client.
Java Servlet and JavaServer Pages (JSP) technology components are Web components
that run on the server.
Enterprise JavaBeans (EJB) components (enterprise beans) are business components that
run on the server.
J2EE components are written in the Java programming language and are compiled in the
same way as any program in the language. The difference between J2EE components and
"standard" Java classes is that J2EE components are assembled into a J2EE application, verified
to be well formed and in compliance with the J2EE specification, and deployed to production,
where they are run and managed by the J2EE server.
J2EE Clients
A J2EE client can be a Web client or an application client.
Web Clients

A Web client consists of two parts: dynamic Web pages containing various types of
markup language (HTML, XML, and so on), which are generated by Web components
running in the Web tier, and a Web browser, which renders the pages received from the
server.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 10

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

A Web client is sometimes called a thin client. Thin clients usually do not do things like
query databases, execute complex business rules, or connect to legacy applications. When
you use a thin client, heavyweight operations like these are off-loaded to enterprise beans
executing on the J2EE server where they can leverage the security, speed, services, and
reliability of J2EE server-side technologies.

Applets

A Web page received from the Web tier can include an embedded applet. An applet is a
small client application written in the Java programming language that executes in the
Java virtual machine installed in the Web browser.

However, client systems will likely need the Java Plug-in and possibly a security policy
file in order for the applet to successfully execute in the Web browser.

Web components are the preferred API for creating a Web client program because no
plug-ins or security policy files are needed on the client systems.

Application Clients

A J2EE application client runs on a client machine and provides a way for users to handle
tasks that require a richer user interface than can be provided by a markup language.

It typically has a graphical user interface (GUI) created from Swing or Abstract Window
Toolkit (AWT) APIs, but a command-line interface is certainly possible.

Application clients directly access enterprise beans running in the business tier.

However, if application requirements warrant it, a J2EE application client can open an
HTTP connection to establish communication with a servlet running in the Web tier.

4. Write about the best practices in J2EE?

A Best Practice is a proven technique for achieving a desired result.

It is a repeatable technique that has been successful in real life situations, and can be
broadly applied across many problems.

Best practices in two major sections:


1. Best practices in theory.
RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 11

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

2. Best practices in practice.


DEVELOPMENT LIFE CYCLE

The most critical element of any application development philosophy is the


methodology that defines the entire application development cycle.

Since methodologies used to make modern J2EE applications are so diverse, we will
not endorse any particular methodology.

Instead, we will define five relatively generic steps that any significant development
method will need to support.

The best practices under each can then be integrated into your development cycle.

The above figure shows the major steps in a development cycle, and the areas in which
Best Practices can be applied for each step.
Development life cycle
Attack risk as early as possible

The risk associated with application development seems to rise exponentially with
complexity.

reducing risk in three ways:

Improving knowledge. The biggest risks will always be associated with the unknown.
Earlier knowledge will allow you to make more informed decisions and better schedules
through the remainder of development cycle.

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 12

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

Allowing recovery time. If youre going to fail, its better to fail early, while theres still
time to recover.

Involving the customer early. Your customers response to a user interface or key
capability can dramatically impact the direction of a project. Inspiring confidence early
improves your relationships.

DESIGN
Design for change with dynamic domain model
Use a standard modeling language
UML (Unified Modeling Language)
Recycle your resources
DEVELOP

Use proven design patterns


Automate the build process
Integrate often
Optimize communication costs

TEST
Build test cases first
Create a testing framework
Automate testing
DEPLOY
Use j2ee standard packaging specification
Use tools to help in deployment
Back up your production data and environment
TUNE
Build a performance plan
Manage memory and plug leaks
Focus on priorities
ENVIRONMENTS
Do not restrict deployment options at design time
RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 13

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

Create a responsive development environment

4.

Comparison between J2EE and .NET

There are many similarities between .NET and J2EE.We are considering the models but in
the real world, J2EE is a programming model based on the Java language, having a concept of a
container (typically application server) that provides services like lifecycle management and
support for declarative transactions. J2EE is based on object oriented design principles; it is a
specification owned by Sun Microsystems, however, Sun does involve the community in
building the specification through the Java Community Process. The core J2EE specification is
supported by multiple vendors most notably Sun Microsystems, BEA and IBM and other vendors
build applications that run on J2EE applications servers. In addition to the 'write once, deploy on
multiple operating systems' feature of Java, J2EE also defines layers of abstractions in the forms
of APIs that provide some level of decoupling between your application and the underlying
infrastructure and resources e.g. as in case of JMS and JDBC APIs.
In the real world, .NET is a programming model that supports multiple languages; it provides
object oriented design principles. The .NET specifications and the core APIs are developed by
Microsoft, however, Microsoft involves the community by actively getting feedback through
multiple channels and uses that feedback to decide the new features of the framework, the .NET
frame work is supported by a large ecosystem of ISVs that develop solutions that utilize the
.NET APIs. The applications developed using the .NET model are typically deployable on the
Windows platform only, however, they can interoperate with applications running on other
RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 14

PLATFORM TECHNOLOGY
UNIT-5

Y3/S
5

platforms using a variety of mechanisms that I will be discussing in my future posts. The new
version of .NET, .NET 2.0, introduces the concept of providers which decouples your
application from the underlying resources like the database and security-credential provider.
Both J2EE and .NET have concepts of Virtual Machines and Just-in-time compilation, J2EE has
a Java Virtual Machine (JVM) that facilities platform choice and .NET has Common Language
Runtime (CLR) that facilitates choice of programming languages, the conceptual architecture for
both the models looks quiet similar.
Keeping all the prejudices aside, it is possible to develop good IT solutions using either
model of programming, there is nothing inherently wrong with .NET or J2EE, those who claim
that a reliable system cannot be developed in Java or that it is not possible to develop a highly
secure and reliable system in .NET have not done their homework or are not current in their
research. It is true that both J2EE and .NET have had their set of issues in the past years,
however both programming models have passed through radical changes and many of the issues
have been resolved some time ago, e.g. I recently corresponded with someone that was
concerned about the inherent capability of .NET to support his enterprise mission critical
application consisting of 100 transactions per second in a system where a 150 million dollars
exchanges take place in an year. It came as news to him that their are many absolutely mission
critical applications running on .NET, including applications that support 3000 transactions per
second with over 5 trillion dollars changing hands (at a stock exchange). Similarly, we have seen
a very complex and large airline reservation system successfully developed and running on
J2EE. The inherent capability of the programming models is only one of the factors and the
architects and technical decision makers need to look at other criteria for making an objective
decision.
6. Explain with diagram the features of .NET and J2EE?
Development model of J2EE and .NET:

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Page 15

PLATFORM TECHNOLOGY
UNIT-5

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Y3/S
5

Page 16

PLATFORM TECHNOLOGY
UNIT-5

RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY/CSE

Y3/S
5

Page 17

You might also like