title: How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?
body: <p>I have an EAR file that contains two WARs, war1.war and war2.war. My application.xml file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"&gt;
    &lt;display-name&gt;MyEAR&lt;/display-name&gt;
    &lt;module&gt;
      &lt;web&gt;
        &lt;web-uri&gt;war1.war&lt;/web-uri&gt;
        &lt;context-root&gt;/&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt;
    &lt;module&gt;
      &lt;web&gt;
        &lt;web-uri&gt;war2.war&lt;/web-uri&gt;
        &lt;context-root&gt;/war2location&lt;/context-root&gt;
      &lt;/web&gt;
    &lt;/module&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>This results in war2.war being available on <strong><a href="http://localhost:8080/war2location" rel="nofollow noreferrer">http://localhost:8080/war2location</a></strong>, which is correct, but war1.war is on <strong><a href="http://localhost:8080//" rel="nofollow noreferrer">http://localhost:8080//</a></strong> -- note the two slashes.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Note that the WARs' sun-web.xml files get ignored when contained in an EAR.</p>