6.7.2: Application deployment tutorial

During this tutorial, you will deploy the J2EE application that you assembled during the Application assembly tutorial. Deployment involves configuring the server and supporting resources (you will use the existing default server), and installing the application. Installing the application means configuring the settings pertaining to this application in the server runtime. The runtime settings include choices such as whether to automatically load servlets, or to precompile JSP files.

Prerequisites

Before performing this tutorial, either:

Overview of steps (requires 15 to 30 minutes)

  1. Obtain the tutorial application
  2. Start the application server
  3. Open the administrative console
  4. Prepare the application server and needed resources
  5. Install the application
  6. Regenerate the Web server plug-in and save the server configuration
  7. Stop the server and start it again
Paths through the tutorial

Obtain the tutorial application

If you completed the Application assembly tutorial, you simply need to know the location of the simpleSession.ear file that you assembled, including generating code for deployment. It should be located in the directory:

product_installation_root/temp/tutorial/assembly/Deployed_simpleSession.ear

If you did not perform the assembly tutorial, and thus plan to use the already assembled .ear file:

  1. Create a directory named "tutorial" under the path:
    product_installation_root/temp
    
  2. Click here to access the .zip file containing the tutorial application components.
  3. Save the .zip file to
    product_installation_root/temp/tutorial
    
  4. Use your favorite .zip or .jar utility to extract the tutorial.zip content into the tutorial directory.
  5. Copy the shortcut_Deployed_simpleSession.ear file. Name the copy Deployed_simpleSession.ear.

Start the application server

First, start the product using:

<product_installation_root>/startServer

Leave the command window open, as you will use it again later to start the server.

Starting the server

  Plan to use the default server configuration file for this tutorial. Other configurations are available, including those that you customize.

  Starting the server from a system command prompt is a method available on all supported operating systems. There are other ways to start the server, as well as variations of the startServer command.

  This tutorial assumes that the commands to start the product and tooling can be issued at a system command window, opened anywhere on your machine. If you have any trouble, change directory to:

product_installation_root/bin
and try the command again.

Open the administrative console

To open the administrative console:

  1. Ensure that the Web server is running on the machine containing the console.
  2. Ensure that the product (application server) is also running. Recall, you started it a while ago.
  3. In a Web browser, enter the URL:
     
    http://your_host_name:9090/admin
    
    where your_host_name is localhost if the Web console is on the local machine. On Windows 2000, it has been found that localhost is not always recognized. In such a case, use the actual host name.
  4. Enter an arbitrary login ID.

      Even if you have not secured the console yet, you will be prompted to log in. The login area explains this somewhat. For more information about the use of this ID, see the help for starting and logging into the console. It will also contain any additions, corrections, and details pertaining to the above instructions.

    Console login

  5. Wait for the console to load into the browser.

    Starting the administrative console

Prepare the application server and needed resources

For the purposes of the tutorial, use the WebSphere runtime environment "as is." The default application server and other resources are everything you need to deploy the simpleSession application.

Install the application

  1. In the tree view on  the left side of the console, expand Nodes -> localhost
  2. Click Enterprise Applications to display a list of applications.
  3. Click the Install button in the right pane.

    Install button

  4. Click Browse.

    Click Browse

  5. Navigate to your deployed .ear file (Deployed_simpleSession.ear), select it and click Open.

    Use Browse dialog to select file

  6. Click Next.
  7. On the Binding Enterprise Beans to JNDI Names panel:
    1. Verify the JNDI Name is set to gs/hello and select Next
  8. On the Mapping EJB References to Enterprise Beans panel:
    1. Verify the Enterprise Bean is set to gs/hello and select Next..
  9. On the Specifying  Virtual Host names... for Web Modules panel:
    1. Set the Virtual Host to default_host
    2. Set the Precompile JSPs to No

      Specifying Virtual Host settings

    3. Click Next.
  10. On the EJB Deploy page, deselect the check box for Re-Deploy option.
    1.  
    Because we deployed the .ear file from the application assembly tool, there is no need to re-deploy the EJB jar now. We could have skipped this step in the assembly tool and deployed the EJB JAR using the administrative console.
       
  11. Click Next.

    Finishing installing the application

  12. Click Finish.

    The application is now displayed in the list of installed applications.

    Application is now listed

  13. In the topology tree, expand Nodes -> hostname -> Application Servers
  14. Select Default Server
  15. Click OK at the bottom of the pane.
Saving the server configuration and regenerating the plug-in configuration

  The administrative console is good at prompting you to take action when you need to do so. In this case, it will now remind you to save your server configuration file and regenerate the configuration of the WebSphere plug-in for the Web server you are using. The prompts are displayed directly below the console menu bar.

  1. Click the first prompt, "Configuration needs to be saved."

    Reminder to save configuration

  2. On the Save Configuration panel, click OK.
  3. Return to the Enterprise Applications collections view where the two prompts were displayed. You should be able to do so by clicking your browser's Back button twice.

    If that does not work, in the tree view of the console, click:
    Nodes -> your_host_name -> Enterprise Applications

  4. Now click the second prompt, "Plug-in configuration needs to be regenerated."
  5. On the Web Server Plug-In Configuration panel, click Generate.
  6. When returned to the Enterprise Applications page, confirm that the prompt now says: New plug-in configuration has been generated.
Stopping the application server and starting it again

  1. In the tree view of the console, click:
    Nodes -> your_host_name -> Application Servers to display the Application Servers collections view, including the Default Server.

    Application Server collection

  2. Click Stop.
  3. Click OK when the screen discussing the implications of stopping the server is displayed.
  4. Close the Web browser.
  5. Start the server, using the startServer script, as described earlier in this tutorial.

    The server will issue a confirmation message in the launch window when it has started successfully.

    Confirming that the server started

  Because adding a new application requires a change to the server configuration file, the server must be stopped and started again to pick up the change. However, there are some types of changes you can make to an installed application that do not require stopping the server and starting it again. See the dynamic reloading and hot deployment documentation for more information.

What's next?

Now that you have your application deployed, it is time to verify that users will be able to access it, using either a Web client or Java client. The next steps are described in the Application testing tutorial.