Cargo
  1. Cargo
  2. CARGO-516

Deploying a WAR into <context>ROOT</context> results in two apps being deployed

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.3.1-maven2
    • Fix Version/s: 1.0.1-beta-2, 1.0.1-beta-3, 1.0.1
    • Component/s: Maven2
    • Labels:
      None
    • Environment:
      OS X 10.4.9
      Java 1.5.0_07
      Maven 2.0.6
    • Complexity:
      Intermediate
    • Tested on JDKs:
      JDK 5
    • Number of attachments :
      0

      Description

      I got this to work by using:

      <deployable>
      <properties>
      <context>ROOT</context>
      </properties>
      </deployable>

      (full configuration below)

      I'm using the cargo-maven2-plugin 0.3.1. Unfortunately, it seems to
      have a bug in that it deploys the WAR twice - once at / and a second
      time at /ROOT. Obviously, its not that big of a deal, but if I use
      <context>anything</context>, it only deploys it once.

      Thanks,

      Matt

      <plugin>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <version>0.3.1</version>
      <configuration>
      <wait>$

      {cargo.wait}

      </wait>
      <container>
      <containerId>$

      {cargo.container}</containerId>
      <!-home>${cargo.container.home}</home->
      <zipUrlInstaller>
      <url>${cargo.container.url}</url>
      <installDir>${installDir}</installDir>
      </zipUrlInstaller>
      </container>
      <configuration>
      <home>${project.build.directory}/${cargo.container}

      /container</home>
      <properties>
      <cargo.hostname>$

      {cargo.host}

      </cargo.hostname>
      <cargo.servlet.port>$

      {cargo.port}

      </cargo.servlet.port>
      </properties>
      <deployables>
      <deployable>
      <properties>
      <context>ROOT</context>
      </properties>
      </deployable>
      </deployables>
      </configuration>
      </configuration>
      <executions>
      <execution>
      <id>start-container</id>
      <phase>pre-integration-test</phase>
      <goals>
      <goal>start</goal>
      </goals>
      </execution>
      <execution>
      <id>stop-container</id>
      <phase>post-integration-test</phase>
      <goals>
      <goal>stop</goal>
      </goals>
      </execution>
      </executions>
      </plugin>

        Issue Links

          Activity

          Hide
          Matt Raible added a comment -

          I figured out a workaround - or possibly a solution - depending on how you want to look at it. If you add a META-INF/context.xml file in your project (in src/main/webapp) with the following contents, it only deploys the WAR once:

          <Context path=""/>

          Show
          Matt Raible added a comment - I figured out a workaround - or possibly a solution - depending on how you want to look at it. If you add a META-INF/context.xml file in your project (in src/main/webapp) with the following contents, it only deploys the WAR once: <Context path=""/>
          Hide
          Matt Raible added a comment -

          This is still an issue. If you use <cargo.datasource.datasource> to configure a JNDI DataSource in Tomcat - you can add a context.xml file with a blank path. If you do, it overrides the JNDI DataSource. The easiest workaround seems to be to put all the <Resource> information in the context.xml. It'd be nice if Cargo allowed you to deploy a ROOT war to Tomcat w/o requiring you to add a context.xml to your war.

          Show
          Matt Raible added a comment - This is still an issue. If you use <cargo.datasource.datasource> to configure a JNDI DataSource in Tomcat - you can add a context.xml file with a blank path. If you do, it overrides the JNDI DataSource. The easiest workaround seems to be to put all the <Resource> information in the context.xml. It'd be nice if Cargo allowed you to deploy a ROOT war to Tomcat w/o requiring you to add a context.xml to your war.
          Hide
          Christian Nelson added a comment -

          I'm using the 1.0-beta2 version of the cargo plugin and I'm still seeing this double-deploy problem when deploying to root. Any suggestions? Is this on anyone's radar?

          Show
          Christian Nelson added a comment - I'm using the 1.0-beta2 version of the cargo plugin and I'm still seeing this double-deploy problem when deploying to root. Any suggestions? Is this on anyone's radar?
          Hide
          anthony bargnesi added a comment -

          I experienced the double context problem (/ and ROOT) even when I had path="" in the META-INF/context.xml.

          It worked for me when I deploy a ".war" file from cargo against Tomcat 6.0.24. Tomcat seems to interpret that as the / context and redeploy appropriately.

          Show
          anthony bargnesi added a comment - I experienced the double context problem (/ and ROOT) even when I had path="" in the META-INF/context.xml. It worked for me when I deploy a ".war" file from cargo against Tomcat 6.0.24. Tomcat seems to interpret that as the / context and redeploy appropriately.
          Hide
          Savas Ali Tokmen added a comment -

          Does this still happen ?

          Show
          Savas Ali Tokmen added a comment - Does this still happen ?
          Hide
          Savas Ali Tokmen added a comment -

          CARGO-459 is closed, closing all dependent issues.

          Show
          Savas Ali Tokmen added a comment - CARGO-459 is closed, closing all dependent issues.
          Hide
          Matt Raible added a comment -

          I don't believe so. I'll open a new issue if it does.

          Show
          Matt Raible added a comment - I don't believe so. I'll open a new issue if it does.
          Hide
          tibi added a comment -

          working here:

          <!-- Tomcat plugin to install -->
          <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>tomcat-maven-plugin</artifactId>
          <configuration>
          <url>$

          {tomcat.deploy.url}

          </url>
          <path>/ROOT</path>
          <username>******</username>
          <password>******</password>
          </configuration>
          </plugin>

          Show
          tibi added a comment - working here: <!-- Tomcat plugin to install --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <url>$ {tomcat.deploy.url} </url> <path>/ROOT</path> <username>******</username> <password>******</password> </configuration> </plugin>
          Hide
          tibi added a comment -

          only undeploy is not working

          Show
          tibi added a comment - only undeploy is not working

            People

            • Assignee:
              Unassigned
              Reporter:
              Matt Raible
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: