IBM RAD
Section - 7) Packaging and
Deployment
Vinod Patidar
© 2008 IBM Corporation
IBM AI - RAD
Section 7 - Packaging and Deployment (9%)
Create J2EE projects
Import and export J2EE modules
Create and locate resources in the
appropriate location of the project
hierarchy
Work with Web and Application
Deployment Descriptor Editors
IBM AI - RAD
What is J2EE?
Enterprise application development Specification
Platform for
- developing, deploying and managing
- n-tier ,web-enabled ,server centric and component
based enterprise application
IBM AI - RAD
J2EE Architecture
IBM AI - RAD
J2EE Multi-tier Model
IBM AI - RAD
J2EE Benefits
Standards
- A wide range of standard services, components, clients, and tools are
supported
- Applications are portable across J2EE platforms
Distribution
- Provides scalability for performance and availability
Common services
- Most commonly required services are provided by J2EE servers
Component model
- Good separation of development responsibilities
- Good reuse of code and opportunities to share logic between
applications
Interoperability
- Integration with other systems using standard protocols
IBM AI - RAD
J2EE Perspective
Code Editor
Project Explorer
Resource Views
IBM AI - RAD
Associating Projects with a Server
There are several ways to associate a project with a
server:
- From the project context pop-up menu, select Run As > Run
on server
You will be able to choose a server in the dialog, and associate the
project with that server
- From the server context pop-up menu in the Servers view,
select Add and Remove Projects…
The server will be started in order to add or remove projects
- From the project context pop-up menu, select Properties >
Server
From here, you can set the runtime target and the default server
IBM AI - RAD
J2EE Packaging
The J2EE specification defines standard archive
formats for all J2EE components
- EJB module
Packaged in a Java archive (.jar) file
- Web module
Packaged in a Web archive (.war) file
- Application client module
Packaged in a Java archive (.jar) file
- Resource adapter module
Packaged in a resource adapter archive (.rar) file
- Enterprise application
Packaged in an enterprise archive (.ear) file
IBM AI - RAD
J2EE Packaging – Containment Hierarchy
ejb1.jar
ejb1.jar EJB
EJB
ejb-jar.xml
Servlet
Servlet
web1.war
web1.war JSP
JSP
web.xml web
web resource
resource
app1.ear
client1.jar client
client class
class
client1.jar
application.xml application-client.xml
native
native library
library
res1.rar
res1.rar
ra.xml adapter
adapter jar
jar
IBM AI - RAD
EJB Module
An EJB module is contained in an EJB jar file
Several beans may be packaged within a single EJB jar file
The EJB JAR contains all the classes required for each EJB
- The enterprise bean class
- The enterprise bean home and component interfaces
- The primary key class if the bean is an entity bean
The deployment descriptor (ejb-jar.xml) contains:
- EJB structural information
Defining the class names, external dependencies, persistent fields and
relationships (for CMP beans)
- Application assembly information describing how the EJBs fit into a wider
application
Security information and transaction attribute
IBM AI - RAD
Web Module
Web modules (also known as Web applications) are contained
in a Web archive (.WAR) file
A WAR file will normally contain several Servlets, JavaServer
Pages and other Web resources
- For example, a Web application may contain HTML files, graphics files,
audio files and movies
The deployment descriptor (web.xml) contains configuration
information for resources contained in the war file
- For example, initialization parameters, session management
configuration, Servlet declarations and mappings, filter definitions,
welcome file list, and error pages
- Security information, tag libraries, and JNDI configuration may also be
provided
IBM AI - RAD
Application Client Module
Application clients are contained in jar file
An application client JAR file contains all the classes required
for the client to function
The deployment descriptor (application-client.xml) contains
configuration information for the client
- The enterprise beans and external resources referenced by the
application client
The mechanism for deployment and installation of the
application client is not specified in the J2EE specification
J2EE product providers may provide an application launcher
that integrates with the application client machine’s native
operating system
IBM AI - RAD
Resource Adapter Module
Resource adapters are contained in a resource adapter
archive (.RAR) file
A resource adapter archive RAR file contains:
- Java code for the resource adapter
- Utility Java classes for the resource adapter
- Platform-dependent native libraries required by the resource adapter
- Help files and documentation
The deployment descriptor (ra.xml) contains:
- General information on the adapter
- The class names of the connection factory and implementation class
- Transaction and security information
IBM AI - RAD
Enterprise Application
Enterprise applications are contained in an enterprise
archive (.ear) file
An enterprise archive file contains one or more J2EE
modules
- EJB jars, wars, application client jars and rars
The enterprise application deployment descriptor
(application.xml) contains:
- Details of all the modules packages in the ear file
- Definitions of security roles for the enterprise application
IBM AI - RAD
Relationship between Projects and J2EE Packages
In J2EE V1.4 there are four application component types
supported by the runtime environment:
- Application Clients
- Applets
- Web applications (servlets, JSPs, and HTML pages)
- EJBs
J2EE components are packaged for deployment as modules:
- Application client module
- Web application module
- EJB module
- Resource adapter module
Rational Application Developer projects map to J2EE packages
IBM AI - RAD
J2EE Packaging Structure Review
Application
DD
J2EE
Installed Application
RA
DD
RARs EAR file IBM
Bind/Ext was.policy
(Java2 Sec)
EJB Web Client
Module Module Module
JAR file WAR file JAR file
Client
Schema DD
Map
Servlet HTML, Client
Schema
EJBs GIFs, and
Attributes JSP Classes
so on
IBM Bind
Table EJB
Creation DD
IBM
IBM Web
Bind/Ext
Bind/Ext DD
IBM AI - RAD
Data Sources Defined in Enhanced EAR
Application-related properties and data sources can be defined
within an application to simplify application deployment
- Configuration files added to the J2EE EAR file as an IBM extension
Properties are used when application is installed
Data source is registered with the WebSphere V6.1 server
when the application is started
Configuration variables can be defined for substitution with
server values when application is installed
Enhanced EAR
Components
Components J2EE Enterprise
Resources
Application
(EAR)
Properties
IBM AI - RAD
Other Properties Defined in the Enhanced EAR
1
2
3
5
4
6
7
IBM AI - RAD
Exporting Web Applications
A Web application can
be exported in two ways
using the context menu:
- As an EAR file
- As a WAR file
IBM AI - RAD
Sharing Projects between Workspaces
Project Interchange is an
export feature that allows the
export of entire projects.
The project structure is
maintained, including
metadata files.
- Unlike exporting a WAR, where
you may lose metadata.
Unrelated projects can be
exported.
- You can then
easily import the projects into
another workspace with a
single action.
IBM AI - RAD
J2EE Components in a Three-Layer Design
The following J2EE components live in the:
- Presentation layer
- Business layer
- Integration layer
Presentation Business Integration
Layer Layer Layer
Servlets Session
SDOs
Entity Beans
JSP/JSF Entity
Pages JavaBeans
Entity Beans
Java
JavaBeans
JavaBeans
Java
Java
HTML
Pages
IBM AI - RAD
Universal Test Client (UTC)
Server tools provide Universal Test Client support,
allowing you to:
- Test your enterprise
beans and other
Java™ objects
- Test the local or
remote interface
methods of your
enterprise beans
- Find an enterprise
bean when you
know or do not know
the JNDI name
IBM AI - RAD
Publishing Applications
Application Developer supports:
- WebSphere test environment in the development
environment
- Tomcat test environment in the development environment
- WebSphere local or remote server outside the development
environment
- Tomcat local server outside the developer environment
- J2EE Web publishing server
- Static Web publishing server
IBM AI - RAD
Publishing Applications
The server tools provide several publishing methods
that you can use when publishing projects and files.
Server Name and Type Server Status
IBM AI - RAD
Checkpoint
1.What are the four application component types
supported by the runtime environment?
2.What are the four modules used to package J2EE
components?
3.Name two components of the WAR file.
4.You have a static Web project. Which archive can
you use to export it: WAR or EAR?
5.What is one of the most common uses of the
enhanced EAR?
6.What is the difference between exporting in .zip
format and in project interchange format?
IBM AI - RAD
Checkpoint answers
1.The four application component types supported by the runtime
environment:
- Application Clients, Applets, Web applications (servlets, JSPs, HTML
pages, and so on), and EJBs
2.The four module types used to package J2EE components:
- Application client module, Web application module, EJB module, and
Resource adapter module
3.Servlets, JSPs, HTML pages, and Web Deployment Descriptor
4.WAR
5.Substitution variables, authentications, shared libraries, virtual
hosts, class loader mode, WAR class loader policy, and start
weight.
6.The project interchange format preserves the metadata.
IBM AI - RAD
Checkpoint
1.What is an EAR?
2.What are the four types of modules contained in an
EAR?
3.What are the three types of archives contained in an
EAR?
4.Which archive type contains servlets and JSP
pages?
IBM AI - RAD
Checkpoint solutions
1.Enterprise Archive
2.EARs can contain the following modules:
• EJB
• Web
• Resource Adapter
• Client Application
3.The three types of archive files are:
• WAR (Web Archive)
• RAR (Resource Archive)
• JAR (Java Archive)
4.WAR
IBM AI - RAD
Grazie Hebrew
Italian
Russian
Gracias Spanish
Obrigado
Thank
Portuguese
Arabic
Merci
French
Traditional Chinese
You English
Danke
German
Simplified Chinese Thai
Korean
Japanese