FreeKB - IBM WebSphere Context root of an application (application.xml, ibm-web.ext.xml)
IBM WebSphere - Context root of an application (application.xml, ibm-web.ext.xml)

Context root is a unique string that is used to request a certain application. In this example, the context root is "/beta", which is used to get the beta application.


To determine the context root of an application

  1. In the WebSphere admin console, expand Applications > All applications.
  2. Select your application.
  3. Select Context Root for Web Modules. The context root will be displayed.

For example, the context root of the Beta application is /beta.


Change context root

The context root can be changed by selecting Applications > All Applications > app > Context root for web modules, changing the context root, and then restarting the application server. However, this is not an ideal solution, because the context root would need to be fixed everytime the app is deployed. A much more reasonable solution will be to set the context root in the development tool, such as Eclipse. If you are deploying an EAR, you would set the context root in the application.xml file. The application.xml file will reside in the /WEB-INF/lib/ directory of the EAR. In this example, the display name of the EAR is Delta, and the context root of the Beta.war in the EAR is /beta.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<application id="Application ID" version="7">
  <module id="Module_123456789">


If you are deploying a WAR, you would set the context root in the ibm-web-ext.xml file. The ibm-web-ext.xml file will reside in the /WEB-INF directory of the WAR. In this example, the context root of the Beta.war is /beta.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
  <context-root uri="/beta"/>


Deployment Descriptor

Technically, when the EAR or WAR is deployed, the deployment descriptor will have the context root of /beta. The deployment descriptor is the file that is read by WebSphere to set the context root. An applications deployment descriptor XML file can be viewed in the WebSphere admin console.  Or, the XML file can be viewed on the command line, at dmgr_home/profiles/your_profile/wstemp/######/workspace/cells/your_cell/application/your_app/deployments/your_app/META-INF/application.xml.

  1. In the WebSphere admin console, expand Applications and select All Applications.
  2. Select an application.
  3. Select View Deployment Descriptor.

In this example, the deployment descriptor file has a context root of /beta.

<application id="Application_ID" version="7" xsi:schemaLocation="" >
 <display-name> Delta </display-name>
 <initialize-in-order> False </initialize-in-order>
   <module id="Module_1521378866851" >
       <web-uri> Beta.war </web-uri>
       <context-root> /beta </context-root>


Using the deployment descriptor file, the context root will be set to whatever context root is listed in the deployment descriptor file.


The application will be able to be requested using the context root.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter c693e in the box below so that we can be sure you are a human.


May 12th, 2020 by ANUBHAV GUHA

June 4th, 2020 by Ryan
Thanks, Jeremy. Was exactly what we needed!

Web design by yours truely - me, myself, and I   |   |