JBoss, a division of Red HatJBoss.org - Community driven.

JBoss Web Web Application Deployment

Table of Contents

Introduction

Deployment is the term used for the process of installing a web application (either a 3rd party WAR or your own custom web application) into the JBoss Web server.

Web application deployment may be accomplished in a number of ways within the JBoss Web server.

  • Statically; the web application is setup before JBoss Web is started
  • Dynamically; Using the command line or the Web Management Interface of AS7 or manipulating already deployed web applications

Installation

There is no installation required for static or dynamic deployment of web applications as this is provided out of the box by JBoss Web. Nor is any installation required for deployment functions with the JBoss Web Manager, although some configuration is required as detailed in the JBoss Web Manager manual.

A word on Contexts

In talking about deployment of web applications, the concept of a Context is required to be understood. A Context is what JBoss Web calls a web application.

In order to configure a Context within JBoss Web a Context Descriptor is required. A Context Descriptor is simply an XML file that contains JBoss Web related configuration for a Context, e.g naming resources or session manager configuration.

Deployment on JBoss Web startup

If you are not interested in using the JBoss Web Manager, or TCD, then you'll need to deploy your web applications statically to JBoss Web, followed by a JBoss Web startup. The location you deploy web applications to for this type of deployment is called the appBase which is specified per Host. You either copy a so-called exploded web application, i.e non-compressed, to this location, or a compressed web application resource .WAR file.

The web applications present in the location ${jboss.server.base.dir}/standalone/deployments/ will be deployed on JBoss Web startup.

Deploying on a running JBoss Web server

It is possible to deploy web applications to a running JBoss Web server.

Depending on the deployment-scanner configuration the application web are deployed dynamicly and/or updated, the deployment-scanner is a sub system:

[standalone@localhost:9999 /] ./subsystem=deployment-scanner:read-resource(recursive=true)
{
    "outcome" => "success",
    "result" => {"scanner" => {"default" => {
        "auto-deploy-exploded" => true,
        "auto-deploy-zipped" => true,
        "deployment-timeout" => 60L,
        "name" => "default",
        "path" => "deployments",
        "relative-to" => "jboss.server.base.dir",
        "scan-enabled" => true,
        "scan-interval" => 5000
    }}}
}

For example if a new .WAR is dropped into the ${jboss.server.base.dir}/standalone/deployments/ directory it will be deployed automaticly.

The webapps are deployed or redeployed in the following cases:

  • Deployment of .WAR files copied into the ${jboss.server.base.dir}/standalone/deployments/ directory.
  • Deployment of exploded web applications which that are copied there too.
  • Re-deployment of a web application which has already been deployed from a .WAR when the new .WAR is provided.
  • Re-deployment of a web application if the /WEB-INF/web.xml file (or any other resource defined as a WatchedResource) is updated.
  • Undeployment of a web application if the .WAR file is removed of the exploded files are removed.

Deploying using the command line

Use the command line: ${jboss.server.base.dir}/bin/jboss-admin.sh For example:

 bin/jboss-admin.sh 
 You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
 [disconnected /] connect
 Connected to standalone controller at localhost:9999
 [standalone@localhost:9999 /] deploy /home/jfclere/jbossweb_sandbox/webapps/myapp.war
 'myapp.war' deployed successfully.
 
To undeploy:
 [standalone@localhost:9999 /] undeploy myapp.war
 Successfully undeployed myapp.war.