Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define contextroot inside WAR file

I have an automated deployment script to deploy multiple WAR files in WAS 7. So, I would like to define contextroot inside the WAR file itself. It should automatically set to " ... -contextroot xxxx ..." from the file.

How do I do that? I think, I need to add something with WEB-INF/ibm-web-bnd.xml. I dont know what to write in it.

Pls help, thanks.

like image 787
Mohamed Saligh Avatar asked Dec 13 '11 05:12

Mohamed Saligh


People also ask

What is context root in Tomcat?

The context path refers to the location relative to the server's address which represents the name of the web application. By default, Tomcat derives it from the name of the deployed war-file. So if we deploy a file ExampleApp. war, it will be available at http://localhost:8080/ExampleApp.

How do I add a context root in web xml?

To Set the Context RootA context root must start with a forward slash (/) and end with a string. In a packaged web module for deployment on the GlassFish Server, the context root is stored in glassfish-web. xml.


1 Answers

Create WEB-INF/ibm-web-ext.xml with these contents:

<web-ext
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://websphere.ibm.com/xml/ns/javaee"
  xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
  version="1.0"
>
  <context-root uri="/TestProject"/>
</web-ext>
like image 112
Brett Kail Avatar answered Oct 18 '22 07:10

Brett Kail