WAS v8.5 > Deploy applications > Deploy applications to the Liberty profile

Deploy a web application to the Liberty profile

By deploying a helloworld.war application, we can learn how server configurations change in the Liberty profile.

The helloworld.war application uses a simple servlet to display a message on your browser. We can create any other messages to be displayed. The coding of the application is not described within the Liberty profile documents. When you deploy a web application to the Liberty profile when the server is up and running, all configurations related to the application are automatically enabled in server.xml. However, we can also configure server.xml manually by completing the following steps.

This example uses the helloworld.war application and can be accessed via http://localhost:9090/helloworld. In this example, we create a Liberty profile server instance and change its default HTTP port to 9090, then deploy the application on it.

  1. Create a server named hwserver using the command server create hwserver.

  2. Create a directory apps for application deployment under the newly created server directory. The directory should be like /usr/servers/hwserver/apps.
  3. Copy the helloworld.war application into the apps directory created.
  4. Change the default HTTP port of the server hwserver to 9090 by adding the following line into server.xml.

  5. Configure the application by updating the server.xml as follows:
    <server description="Hello World Server"> 
     < featureManager>
       <feature>servlet-3.0</feature>  </featureManager> 
    < httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9090" /> 
    <application context-root="helloworld" type="war" id="helloworld" 
        location="helloworld.war" name="helloworld"/> 
    </server>
    Where context-root specifies the entry point of the deployed application. The entry point of a deployed application is determined in the following precedence:

    • context-root in server.xml
    • application.xml, if an EAR application
    • ibm-web-ext.xml, if a web application
    • name of the application in server.xml, if a web application
    • Manifest.MF, if a WAB application
    • Directory name or the file name relative to the "dropins" directory of the Liberty profile

  6. Start the server in foreground using the command server run hwserver.
  7. Test the application at http://localhost:9090/helloworld.
  8. Optional: Stop the server if we don't need it.


Parent topic: Deploy applications to the Liberty profile


|