Deploying applications to managed Liberty targets

You can install enterprise applications or modules on managed Liberty servers and managed Liberty clusters with the administrative console or wsadmin scripting.

[Network Deployment 9.0.5.24 or later]You can configure static clusters for managed Liberty servers.

Before you install an application, configure the target managed Liberty server or managed Liberty cluster. As part of the configuration, determine whether your application files can be installed to your deployment target.

Tip: Before you deploy your applications, you can deploy sample applications as part of a hands-on lab where you deploy them to a managed Liberty server or as of 9.0.5.24, a managed Liberty cluster. You can also download the samples and run them beyond the lab for demonstration purposes.

Enterprise modules installable on managed Liberty servers and managed Liberty clusters

You can install the following enterprise modules on managed Liberty servers and managed Liberty clusters:

  • Enterprise archive (EAR)
  • Web archive (WAR)

Install files that use Jakarta EE 10 specifications and a supported Java™ SE version on a managed Liberty server or a managed Liberty cluster.

Supported modules include EAR and WAR files that run on a supported Java SE version and Jakarta EE Core profile 10. For more information about supported modules and supported Java SE versions, see Modernized Runtime Extension for Java overview. For information about unsupported Jakarta EE 10 applications, see Known issues and limitations.

Installing applications on managed Liberty servers and managed Liberty clusters with the console

Use the application installation wizard in the administrative console to install an application on a managed Liberty server or a managed Liberty cluster. The following steps mention wizard pages that are shown, at minimum, when the Target runtime option is set to WebSphere Liberty in the application installation wizard. For a list of console page changes, see Settings in MoRE.

  1. In the administrative console, complete one of the following paths to go to the application installation wizard.

    • Click Applications > New application > New Enterprise Application.
    • Click Applications > Install new middleware application > Enterprise Java Application.
    • Click Applications > Application Types > WebSphere enterprise applications > Install.
  2. On the first Preparing for the application installation page, make selections for a deployment to a managed Liberty server target.

    1. Specify the full path name for an EAR or WAR file that can run on a managed Liberty server or a managed Liberty cluster.
    2. For Target runtime, select WebSphere Liberty.
    3. Click Next.
  3. Progress through the wizard pages to install your application files. For a managed Liberty server target, the following wizard pages are shown when the Fast Path option is selected on the second Preparing for the application installation page.

    Select installation options

    On the Select installation options page, you can change the Application name and other values. The Use binary configuration setting must be selected for a WebSphere Liberty target runtime, and you cannot deselect it.

    Several options are not available for a WebSphere Liberty target runtime, and are only available when Target runtime is set to WebSphere Application Server traditional. For a list of changes to the page, see Settings in MoRE.

    Map modules to servers

    On the Map modules to servers page, each Module must map to one or more Server targets. Ensure that your application modules map to one, and only one, managed Liberty server or managed Liberty cluster. If the Server value for a module isn't a managed Liberty server or a managed Liberty cluster, change the mapping.

    1. In the list of mappings, select each module to map to the managed Liberty server target.

    2. From the Clusters and servers list, select one managed Liberty server target.

      Use the Ctrl key to select multiple targets. For example, to have a web server serve your application, press the Ctrl key and then select a managed Liberty server target and the web server together. The product generates the plug-in configuration file plugin-cfg.xml, for that web server based on the applications that are routed through it.

      [Network Deployment 9.0.5.23 only]Avoid trouble: Currently, a limitation deletes a mapping to a web server after you sync changes. For more information, see the WebServer plug-in section in Known issues and limitations. To map a managed Liberty server target and a web server together, use a Manage modules page after you install the application and sync changes.
    3. Click Apply.
    Map virtual hosts for web modules

    On the Map virtual hosts for web modules page, specify a virtual host for your web module. The page is shown in the application installation wizard if your application contains a web module (.war file).

    By default, web modules use the default_host virtual host. Unless you want to isolate your web module from other modules or resources on the same node, default_host is a suitable virtual host for your web module. After application deployment, you cannot change the setting.

    Map context roots for web modules

    On the Map context roots for web modules page, specify a context root for your web module. The page is shown in the application installation wizard if your application contains a web module.

    If your application sets the web module context-root in the application.xml file, then that value takes precedence over a default-context-root set in the web archive's web.xml file. You can change the context root on this wizard page.

    [Network Deployment 9.0.5.23 only]After application deployment, you cannot change the context root.

    Summary

    On the Summary page, verify the target cell, node, and server and click Finish.

    For more information about installation wizard pages, see Installing enterprise application files with the console in the WebSphere Application Server Network Deployment 9.0.5 documentation.

  4. Save the changes to your administrative configuration. When you save the changes, select to sync the changes to the repository.

    The application is shown in the list of installed applications on the Enterprise applications page. The status of the application is unknown, even when the application is running. For more information, see Known issues and limitations.

    Click the application name to see details in the enterprise application settings.

Installing applications on managed Liberty servers and managed Liberty clusters with wsadmin scripting

Use the wsadmin AdminApp.install or AdminApp.installInteractive commands to install a Jakarta EE 10 application on a managed Liberty server or a managed Liberty cluster.

  1. Start the wsadmin tool.

    wsadmin -lang jython
  2. Run the wsadmin AdminApp.install or AdminApp.installInteractive command to install an application.

    • Install an application with AdminApp.install.

      With the install command, specify the managed Liberty server or the managed Liberty cluster, the -MapModulesToServers option or in the -server or -node options, or the -cluster option.

      The following example command installs the ee10.war file and specifies the mls1 managed Liberty server in the -MapModulesToServers option.
      AdminApp.install('ee10.war', '[ -appname ee10_war
       -MapModulesToServers [[ ee10.war ee10.war,WEB-INF/web.xml WebSphere:cell=Cell01,node=Node01,server=mls1 ]]
       -MapWebModToVH [[ ee10.war ee10.war,WEB-INF/web.xml default_host ]]
       -CtxRootForWebMod [[ ee10.war ee10.war,WEB-INF/web.xml /a-context-root ]]]' )
      The following example command installs the ee10-security.ear file and specifies the mlsCluster managed Liberty cluster in the -cluster option.
      AdminApp.install('ee10-security.ear', '[ -appname restfulWS-ee10-security-ear 
       -cluster mlsCluster 
       -MapWebModToVH [[ restfulWS-ee10-security.war restfulWS-ee10-security.war,WEB-INF/web.xml default_host ] 
       [ restfulWS-ee10-security.war restfulWS-ee10-security-basic.war,WEB-INF/web.xml default_host ]]]' )

      For command option descriptions, see Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands using wsadmin scripting in the Network Deployment 9.0.5 documentation.

    • Install an application with AdminApp.installInteractive.

      With the installInteractive command, specify the managed Liberty server or the managed Liberty cluster by specifying WebSphere Liberty for the targetRuntime option.

      1. Run the installInteractive command with the name of the application to install.

        AdminApp.installInteractive('ee10.war')
      2. For the targetRuntime option, specify WebSphere Liberty.

      3. For Task[1]: Specifying application options, specify options as usual.

        For a WebSphere Liberty target runtime, Use Binary Configuration is set to Yes, and you cannot change it. Also, the following options are not available or do not apply when the target is a managed Liberty server or a managed Liberty cluster.

        • Asynchronous request dispatch type
        • Precompile JavaServer Pages files
        • Deploy enterprise beans
        • Create MBeans for resources
        • [Network Deployment 9.0.5.24 or later]Override class reloading settings for Web and EJB modules
        • [Network Deployment 9.0.5.24 or later]Reload interval in seconds
        • Deploy Web services
        • Process embedded configuration
        • [Network Deployment 9.0.5.24 or later]Business level application name
        • [Network Deployment 9.0.5.24 or later]Deploy client modules
        • [Network Deployment 9.0.5.24 or later]Client deployment mode
        • [Network Deployment 9.0.5.24 or later]Directory to install application
        • [Network Deployment 9.0.5.24 or later]File Permission
        • [Network Deployment 9.0.5.25 or later]Application edition
        • [Network Deployment 9.0.5.25 or later]Edition description
        • [Network Deployment 9.0.5.25 or later]Allow dispatching includes to remote resources
        • [Network Deployment 9.0.5.25 or later]Allow servicing includes from remote resources

        In versions earlier than 9.0.5.25, the following options are unavailable:

        • Allow EJB reference targets to resolve automatically (this setting is available but non-functional)

      For more information about changes to the commands, see Scripting commands in MoRE.

  3. Save the changes to your administrative configuration.

    AdminConfig.save()
  4. Confirm that your application is in the list of installed applications.

    print AdminApp.list()

What to do next

The application starts when it's deployed. If the application is not running, start or restart the managed Liberty server or the managed Liberty cluster. Applications start when the managed Liberty server or the managed Liberty cluster starts and remain running until the managed Liberty server or the managed Liberty cluster stops. For more information, see the Liberty servers and clusters limitation.

Test the application. For example, point a web browser at the URL for a deployed application. Typically, the URL is http://hostname:port_number/context_root, where hostname is your valid web server and port_number is the default port number. For a secure URL, use the https protocol and the default secure port number.

The unsecure URL might be shown in the managed Liberty server console.log file at profile_root/logs/server_name/logs/console.log. The URL is shown in a message such as CWWKT0016I: Web application available (default_host): http://hostname:port_number/context_root/.

You can also get a port number for the managed Liberty server by looking at the httpEndpoint_port setting in the /profiles/node_profile_name/config/cells/<cellName>/nodes/<nodeName>/managedLiberty/usr/server/server_name/server.xml file. The following example elements use 9081 for the default port number and 9444 for the default secure port number.

<variable defaultValue="9081" name="httpEndpoint_port"/>
<variable defaultValue="9444" name="httpEndpoint_secure_port"/>