Chapter 23. Packaging and deploying Java EE applications 847
deployed. The resources that can be configured in the enhanced EAR are described in the
following sections.
23.6.1 Creating an environment variable for the application file directory
Use WebSphere environment variables, rather than hardcoded paths, when deploying an
application. In this step, a variable called ITSOBANK_ROOT is defined. The variable represents
the root directory where application resources are stored. You use this variable in subsequent
configuration processes when specifying, for example, the JVM log location.
Complete the following steps to specify the log location:
1. Determine how you want to organize your application files.
There are several ways to organize WebSphere applications. You can create a directory
for each application, such as /apps/application_name, and keep all resources and
directories that are required by the application in subdirectories under this directory. This
strategy works well when deploying only one application per application server because
the application server’s log files can then all be changed to point to the
/apps/application_name/logs directory.
An alternative is to organize resources by resource type and create directories, such as
/apps/logs/application_name.log, /apps/properties/application_name.properties,
and so on.
Finally, you can keep the vendor defaults as much as possible. For WebSphere, vendor
defaults mean that the applications are installed in the profile_root/installedApps
directory and that the logs files are written to the profile_root/logs/server_name
directory.
The option that you choose is a matter of personal preferences and corporate guidelines.
In this example, we deploy a single application to a single application server. A directory
called /apps/ITSOBANK will be used to contain the application resources.
2. Create the target directory on the application server operating system:
/apps/ITSOBANK
3. Use the steps that are described in 6.1.10, “Using variables” on page 205 to create an
ITSOBANK_ROOT variable with a value of /apps/ITSOBANK.
Be certain that you declare this variable at the correct scope. For example, if you define this
variable at the application server scope, it is known only at that level. As long as you work with
the WebSphere Application ServerBase or Express editions, this configuration is fine.
However, if you are using the Network Deployment edition and you create a cluster of
application servers, you need to define the ITSOBANK_ROOT variable at the cluster or cell level.
23.6.2 Creating the ITSO Bank application server
In a distributed server environment, you can use a single application server or create multiple
application servers or clusters.
The advantage of deploying multiple applications to a single application server is that it
consumes less resources. There is no impact for any extra application server processes.
Important: If you define and use the variable in configuration steps, but the directory is
not created, the application server might not start.