JBoss 7: how to change a WAR context root

32,589

Solution 1

this works in AS 7.0.1, WEB-INF/jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root>/my_custom_root</context-root>
</jboss-web>

I don't think it is possible to have app root like "server/something/app", but you can simulate this behavior through application structure

Solution 2

Just for sharing a personal experience...if the context-root in jboss-web.xml seems to be ignored...try to see if it is (the context root) already declared in your application.xml

Share:
32,589
Aikanaro
Author by

Aikanaro

A junior developer (mainly java) and all-around very curious individual. I'm interested in a few subjects such as: - software architecture - enterprise architecture - best practices (development, codewise, project management, etc)

Updated on April 15, 2020

Comments

  • Aikanaro
    Aikanaro about 4 years

    I have an application that is to be deployed in a WAR file (app.war). After deployment it is available from http://:8080/app I would like to have it being made available as something like http://:8080/secret/app

    I searched the documentation and for JBoss'es 5 and 6 this seems to be able to do with a jboss-web.xml file. I have tried it but with no luck. It seems that JBoss 7 just ignores the element inside jboss-web.xml.

    I don't know if this is relevant but this application has both JSF and PrettyFaces.

    Does anyone know if this behavior is possible with JBoss 7? If so, how can it be done? I am still trying to find an answer for this.

    Thank you.

  • Rico
    Rico over 11 years
    See here for more information and options: docs.jboss.org/jbossweb/7.0.x/appdev/jbossweb.html
  • Niks
    Niks about 11 years
    I guess jboss-web.xml is given a higher precedence. If that is absent, then application.xml is respected
  • Marcelo Rebouças
    Marcelo Rebouças over 9 years
    In my case, I was working with jboss 6 server and the jboss-web.xml does not exists. I needed creates the file and set the context-root as suggested by you. Works perfect. Thanks!!!
  • Mohammad Faisal
    Mohammad Faisal over 9 years
    where do I can find this application.xml?
  • Andrea
    Andrea over 9 years
    The application.xml is the deployment descriptor of the enterprise application. You can find that in the root folder of your ear
  • Sarz
    Sarz over 7 years
    How can i restrict URL on localhost:8080/MyApp on this while application will not update URL