0
votes

this has got to be a stupid question but my Google-fu fails me. I have a JBoss server (actually EAP 6.1) and a packaged web application, myapp.war.

By copying the file to .../standalone/deployments/ it gets deployed to <server>/myapp. Renaming the file to somename.war, it becomes <server>/somename, and ROOT.war gets deployed directly on <server.

So far so good.

But how do I get the application to appear under e.g. <server>/antares/myapp?

I tried simply making a subdirectory under deployments/ and placing my war file there, but that still gets deployed simply as <server>/myapp. I also read somewhere on a Tomcat forum to call my file antares#myapp.war, but that resulted in an error when the deployment scanner tried to run it.

Searching around on the web, I so far mostly found (a) descriptions of the folder and subfolder structure of a web project or (b) things about projects and sub-projects and how to handle dependencies.

I don't need all of that, I just want my perfectly fine war file to show up with a slightly deeper path. Preferably without having to touch many configuration files.

What am I missing?

1
This is possible for Tomcat, see this. However, I do not know if this configuration is applicable for JBoss (albeit Tomcat based).Nikos Paraskevopoulos

1 Answers

0
votes

You need to wrap your .war in to a .ear and add the following information in to the application.xml in order to achieve what you want.

 <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee 
                         http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
    <display-name>Your App name</display-name>

    <module>
       <ejb>a-ejb-module-if-you-have-one.jar</ejb>
    </module>
    <module>
          <web>
           <web-uri>myapp.war</web-uri>
           <context-root>antares/myapp</context-root>
          </web>
    </module>

 </application>

Please take a look at the documentation here: Setting the context root of a web application