Chapter 18.
WAR Packaging
This chapter is for the Web component provider; that is, the person in charge of developing the web
components on the server side. It describes how the web components should be packaged.
18.1. Principles
Web components are packaged for deployment in a standard Java programming language Archive file
called a
war
file (Web ARchive), which is a
jar
similar to the package used for Java class libraries.
A
war
has a specific hierarchical directory structure. The top-level directory of a
war
is the document
root of the application.
The document root is where JSP pages, client-side classes and archives, and static web resources are
stored. The document root contains a subdirectory called
WEB-INF
, which contains the following files
and directories:
•
web.xml
: The standard xml deployment descriptor in the format defined in the Java Servlet 2.4
Specification. Refer to
$JONAS_ROOT/xml/web-app_2_4.xsd
.
•
jonas-web.xml
: The optional JOnAS-specific XML deployment descriptor in the format defined
in
$JONAS_ROOT/xml/jonas-web_X_Y.xsd
.
•
classes
: a directory that contains the servlet classes and utility classes.
•
lib
: a directory that contains JAR archives of libraries (tag libraries and any utility libraries called
by server-side classes). If the Web application uses Enterprise Beans, it can also contain
ejb-jars
.
This is necessary to give to the Web components the visibility of the EJB classes. However, if the
war
is intended to be packed in an
EAR
, the
ejb-jars
must not be placed here. In this case, they
are directly included in the
EAR
. Due to the use of the class loader hierarchy, Web components have
the visibility of the EJB classes. Details about the class loader hierarchy are described in Chapter 5
JOnAS Class Loader Hierarchy
.
18.1.1. Example
Before building a
war
file, the Java source files must be compiled to obtain the class files (located in
the
WEB-INF/classes
directory) and the two XML deployment descriptors must be written.
Then, the
war
file (
web-application
.war
) is built using the
jar
command:
cd
your_webapp_directory
jar cvf
web-application
.war *
During the development process, an “unpacked version” of the
war
file can be used. Refer to Section
3.5.3
Configuring the WEB Container Service
.
Summary of Contents for Application Server
Page 1: ...Red Hat Application Server JOnAS User Guide ...
Page 8: ......
Page 22: ...14 Chapter 1 Java Open Application Server JOnAS a J2EE Platform ...
Page 58: ...50 Chapter 3 JOnAS Configuration ...
Page 66: ...58 Chapter 5 JOnAS Class Loader Hierarchy ...
Page 78: ...70 Chapter 6 JOnAS Command Reference ...
Page 80: ......
Page 86: ...78 Chapter 7 Developing Session Beans ...
Page 136: ...128 Chapter 9 Developing Message Driven Beans ...
Page 142: ...134 Chapter 10 Defining the Deployment Descriptor ...
Page 148: ...140 Chapter 11 Transactional Behavior of EJB Applications ...
Page 158: ...150 Chapter 14 EJB Packaging ...
Page 162: ...154 Chapter 15 Application Deployment and Installation Guide ...
Page 164: ......
Page 176: ...168 Chapter 18 WAR Packaging ...
Page 178: ......
Page 184: ...176 Chapter 20 Defining the Client Deployment Descriptor ...
Page 186: ...178 Chapter 21 Client Packaging ...
Page 188: ......
Page 192: ...184 Chapter 23 EAR Packaging ...
Page 194: ......
Page 200: ...192 Chapter 24 JOnAS Services ...
Page 204: ...196 Chapter 25 JOnAS and the Connector Architecture ...
Page 222: ...214 Chapter 27 Ant EJB Tasks Using EJB JAR ...
Page 234: ...226 Chapter 29 Web Services with JOnAS ...
Page 236: ......
Page 260: ...252 Chapter 34 How to use Axis in JOnAS ...
Page 270: ...262 Chapter 36 Web Service Interoperability between JOnAS and BEA WebLogic ...
Page 296: ......