deploytool

 

deploytool

 


deploytool

The Application Deployment Tool (deploytool) is used to create Web Application aRchive (WAR) files:

  1. Start Tomcat

  2. Start deploytool:

    $TOMCAT_HOME/bin/deploytool

  3. In the Set Tomcat Server dialog, enter a valid user name and password. These will have been set up when the Web Services Developer Pack (WSDP) was installed. They can also be modified by using the using the admintool.

  4. Select OK to complete the deployment.

  5. Select File.

  6. Select New Web Application.

    The New Web Application wizard displays. This wizard will help package the webapp into a Web ARchive (.WAR) file to define individual Web components and to generate a deployment descriptor for the webapp. We will use the wizard identify the files in the webapp and to identify any Web components to uniquely identify in the deployment descriptor for the application.

  7. Select Next from the Introduction page.

  8. The Create New Stand-Alone WAR Module section on the WAR File page of the wizard displays.

  9. Select the Browse button next to the Module File Name field and select the path for the directory in which to create this file, for example, the root directory where the example application is generated by Ant, which is the $TOMCAT_HOME/tech/examples/GSApp directory.

  10. Enter the name for the WAR file, for example, GSApp.war, and select the Choose Module File button.

  11. Enter a value in the WAR Display Name field, for example, GSApp.

  12. Select the Edit button in the Contents box to add files to the WAR file.

  13. Select ConverterBean.class from the $TOMCAT_HOME/tech/examples/GSApp/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 based on the build.xml script.

  14. Select index.jsp from the $TOMCAT_HOME/tech/examples/GSApp/build/WEB-INF directory, then select the Add button to add this file to the archive. This directory is where this file was based on the build.xml script.

  15. Select OK to exit the Edit Contents dialog.

  16. Select the Next button to continue.

  17. 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.

  18. Select JSP.

  19. Select Next.

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

  20. Select index.jsp from the JSP Filename list.

  21. Select Finish.

  22. 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.

    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.

  23. Select Tools, then select Deploy.

  24. Select OK to confirm that the WAR is ready to deploy.

  25. To view the deployment descriptor, choose Tools->Descriptor Viewer from the deploytool menu. The simple deployment descriptor generated for this example from the preceding steps looks like this:

    <?xmlversion="1.0"encoding="UTF-8"?> 
    
    <!DOCTYPEweb-appPUBLIC'-
    //SunMicrosystems,Inc.//DTDWebApplication2.3//EN''http://java.
    sun.com/dtd/web-app_2_3.dtd'>
    
    <web-app>
      <display-name>GSApp</display-name> 
      <servlet> 
        <servlet-name>index</servlet-name> 
        <display-name>index</display-name> 
        <jsp-file>/index.jsp</jsp-file> 
      </servlet> 
      <session-config> 
        <session-timeout>30</session-timeout> 
      </session-config> 
    </web-app>
    
    


  Home