The JavaTM Web Services Tutorial
Home
TOC
PREV TOP NEXT

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 the build.xml file. The Ant 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.

  1. In a terminal window, go to the gs/ directory.
2. Type the following command to deploy the Web application files:
   ant install
 

This 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 the deploytool to create a Web Application aRchive (WAR) file for deploying your application and handling security issues. To deploy the application using the deploytool, follow these steps.

  1. Start the deploytool. The deploytool is a command line tool that is located in the bin directory of your Java WSDP installation. On the Unix operating system, the command would be:
    $JWSDP_HOME/bin/deploytool
  2. Select File.
  3. 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.

  1. Select Next from the Introduction page.
  2. Select Create New Stand-Alone WAR Module on the WAR page of the wizard.
  3. In the Module File Name field, enter the name for the WAR file, such as gs.war.
  4. 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.
  5. Enter a value in the WAR Display Name field, for example, GSApp.
  6. Select the Edit button in the Contents box to add files to the WAR file.
  7.  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 the build.xml script.
  8.  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 the build.xml script.
  9.  Select OK to exit the Edit Contents dialog.
  10.  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.

  1.  Select JSP.
  2.  Select Next.

Set the Component Properties

This page of the wizard is the Component General Properties page. On this page, we will select the JSP file.

  1.  Select index.jsp from the JSP File Name list.
  2.  Select Finish.
  3.  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 to localhost with deploytool.

  1. Select Tools, then select Deploy.
  2. Select OK to confirm that the WAR is ready to deploy.
  3. 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.
  4.  Select OK to complete the deployment.

The Deployment console displays. You can Close the window if you'd like.

Home
TOC
PREV TOP NEXT