How to change context path of web application in JBoss / Wildfly

What is context path in a web application
Context path, also called context root is the name with which a web application is accessed in the browser. It is the string after the server ip and port in the application URL.

Example, if the URL of a web application is, then employee-manager is the context path or context root of the application.
Default context path
By default, the name of WAR becomes the context path of the application. Thus, if the name of your WAR is temperature-converter.war, then your application will be accessed at URL assuming that the server is running at ip and port 8080.
Change context path in JBoss / wildfly
If you want to customize the context root of your application so that it can be accessed at URL, then create a file named jboss-web.xml file inside WEB-INF folder of your WAR file with contents as below.

<?xml version=”1.0″ encoding=”UTF-8″?>

In development environment, if you are using eclipse IDE or Spring Tool Suite, then the location of jboss-web.xml should be in src/main/webapp/WEB-INF folder.
Order of preference
If jboss-web.xml file is present at the above specified location in your application, then it will be given first or highest preference.
If it is not present and your application is an EAR file, then the value defined in the context-root element of its application.xml will be considered as context path.
If both are not present, then the name of WAR will be the context path.

Click the clap if you liked this article.


Leave a Reply

Mark Your Impression

Notify of
Close Menu

Never Miss an article !

Get the new post delivered straight into your inbox, enter your email and hit the button

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

codippa will use the information you provide on this form to be in touch with you and to provide updates and marketing.