Professional Documents
Culture Documents
UNIT-5
Y3/S
5
3.
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.
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) defines the standard for developing
multitier enterprise applications.
Page 1
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
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.
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 :
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.
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:
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.
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.
Page 3
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
Sun released its J2EE specification which provided a comprehensive view of the Java
middle tier solution.
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.
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).
Page 5
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
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.
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.
EJBTM enables rapid and simplified development of distributed, transactional, secure and
portable Java applications.
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.
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).
JTA is used for managing distributed transactions (e.g. updates to multiple databases that
must be handled in a single transaction).
Page 7
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
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.
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.
Page 8
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
Multitiered Applications
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.
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.
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.
It is a repeatable technique that has been successful in real life situations, and can be
broadly applied across many problems.
Page 11
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
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.
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.
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
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
4.
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:
Page 15
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
Page 16
PLATFORM TECHNOLOGY
UNIT-5
Y3/S
5
Page 17