Home TOC |
![]() ![]() ![]() |
Deploying the Application
In this release of the Java WSDP there are two options for deploying an application: using the
Ant
tool and using the Application Deployment Tool. For this example, both options require that the Tomcat be started. For further information on deploying Web applications, please read Deploying Web Applications.Starting Tomcat
To start Tomcat, type the following command in a terminal window. This command uses the environment variable
JWSDP_HOME
.$JWSDP_HOME/bin/startup.sh (Unix platform) %JWSDP_HOME%\bin\startup (Microsoft Windows)The startup script starts the task in the background and then returns the user to the command line prompt immediately. Even though you are returned to the command line, the startup script may not have completely started Tomcat. If the Web Client does not run immediately, wait up to a minute and then retry to load the Web client.
Documentation for Tomcat can be found at <
JWSDP_HOME
>/docs/tomcat/index.html.
Installing the Application using Ant
A Web application is defined as a hierarchy of directories and files in a standard layout. In this example, the hierarchy is accessed in an unpacked form, where each directory and file exists in the file system separately. This section discusses deploying your application using the
Ant
tool defined in Creating the Build and Deploy File for Ant.You notify Tomcat of a new context with the
Ant
install
task from thebuild.xml
file. TheAnt
install
task does not require Tomcat to be restarted, but an installed application is also not remembered after Tomcat is restarted. To permanently deploy an application, see Deploying Web Applications.The steps for deploying this Web application follow.
2. Type the following command to deploy the Web application files:
ant installThis command copies the Web client file,
index.jsp
, to<
JWSDP_HOME
>/docs/tutorial/examples/gs/build/
and copies the JavaBeans class file,ConverterBean.class
, to<
JWSDP_HOME
>/docs/tutorial/examples/gs/build/WEB-INF/classes/converterApp/
.Deploying the Application Using the Application Deployment Tool
The Application Deployment Tool,
deploytool
, is included in this release of the Java WSDP. This section discusses using thedeploytool
to create a Web Application aRchive (WAR) file for deploying your application and handling security issues. To deploy the application using thedeploytool
, follow these steps.
- Start the
deploytool
. Thedeploytool
is a command line tool that is located in thebin
directory of your Java WSDP installation. On the Unix operating system, the command would be:
$JWSDP_HOME/bin/deploytool
- Select File.
- Select New Web Component.
The New Web Component wizard displays. This wizard will help package the web application into a Web ARchive (.WAR) file, to define individual web components, and to generate a deployment descriptor for the web application. We will use the wizard identify the files in the web application and to identify any web components to uniquely identify in the deployment descriptor for the application.
Creating the WAR File and Identifying Files in the Web Application
To create the WAR file and tell the New Web Component wizard which files it should contain, follow these steps.
- Select Next from the Introduction page.
- Select Create New Stand-Alone WAR Module on the WAR page of the wizard.
- In the Module File Name field, enter the name for the WAR file, such as
gs.war
.- Select the Browse button or enter the path for the directory in which to create this file, for example, the root directory of the example application, which is the
/gs
directory.- Enter a value in the WAR Display Name field, for example,
GSApp
.- Select the Edit button in the Contents box to add files to the WAR file.
- Select
ConverterBean.class
from the<
JWSDP_HOME>/docs/tutorial/examples/gs/build/WEB-INF/classes/converterApp
directory, then select the Add button to add this file to the archive. This directory is where this file was created based on thebuild.xml
script.- Select
index.jsp
from the<
JWSDP_HOME>/docs/tutorial/examples/gs/build/WEB-INF
directory, then select the Add button to add this file to the archive. This directory is where this file was created based on thebuild.xml
script.- Select OK to exit the Edit Contents dialog.
- Select the Next button to continue.
Choosing the Component Type
This page of the wizard is the Choose Component Type page. On this page, we will select JSP page as the type of component we are creating.
Set the Component Properties
This page of the wizard is the Component General Properties page. On this page, we will select the JSP file.
- Select
index.jsp
from the JSP File Name list.- Select Finish.
- Select File, then select Save to save the WAR file.
The WAR file is created and the contents of the file are displayed on the General tab of the Application Deployment Tool.
Deploy the Application
Once the WAR file is created, we can deploy the application. To do this, follow these steps. When you choose the
deploy
operation, it copies the WAR it creates to Tomcat and notifies Tomcat of the new context. You can only deploy tolocalhost
withdeploytool
.
- Select Tools, then select Deploy.
- Select OK to confirm that the WAR is ready to deploy.
- In the Specify Server Attributes dialog, enter a valid user name and password. These will have been set up when the Java WSDP was installed, or can be set up using admintool. Information on setting up users with admintool can be read at Using admintool.
- Select OK to complete the deployment.
The Deployment console displays. You can Close the window if you'd like.
Home TOC |
![]() ![]() ![]() |