title: Maven with Cargo and Installed Glassfish
body: <p>I have been having trouble getting this my maven project to work. I will show below my pom file and my error log. I am trying to run integration tests of my code on glassfish after it is deployed. Any help will be much appreciated. If there is a better solution to do that, that would also be appreciated.</p>
  
  <p>pom.xml cargo portion:</p>
  
  <pre><code>&lt;!-- cargo plugin --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
              &lt;artifactId&gt;cargo-core-uberjar&lt;/artifactId&gt;
              &lt;version&gt;1.4.3&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;!-- cargo plugin --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
                      &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;
                      &lt;version&gt;1.4.3&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;container&gt;
                              &lt;containerId&gt;glassfish4x&lt;/containerId&gt;
                              &lt;type&gt;installed&lt;/type&gt;
                          &lt;/container&gt;
                          &lt;configuration&gt;
                              &lt;type&gt;existing&lt;/type&gt;
                              &lt;home&gt;C:\glassFishV4\glassfish4\glassfish\domains&lt;/home&gt;
                              &lt;properties&gt;
                                  &lt;cargo.hostname&gt;localhost&lt;/cargo.hostname&gt;
                                  &lt;cargo.servlet.port&gt;4848&lt;/cargo.servlet.port&gt;
                                  &lt;!-- if no username/password don't use these, it will fail --&gt;
                                  &lt;cargo.remote.username&gt;admin&lt;/cargo.remote.username&gt; 
                                  &lt;cargo.remote.passwordFile&gt;C:\glassfish\glassfish4\glassfish\domains\domain1\config\admin-keyfile&lt;/cargo.remote.passwordFile&gt;
                                  &lt;cargo.glassfish.domain.name&gt;domain1&lt;/cargo.glassfish.domain.name&gt;
                              &lt;/properties&gt;
                          &lt;/configuration&gt;
                          &lt;deployables&gt;
                              &lt;deployable&gt;
                                  &lt;groupId&gt;com.project&lt;/groupId&gt;
                                  &lt;artifactId&gt;projectID&lt;/artifactId&gt;
                                  &lt;location&gt;${project.build.directory}/${project.build.finalName}.war&lt;/location&gt;
                                  &lt;type&gt;war&lt;/type&gt;
                              &lt;/deployable&gt;
                          &lt;/deployables&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
  </code></pre>
  
  <p>Error Log:</p>
  
  <pre><code>C:\Users\kev\projectID\com.project.projectID-1.0&gt;mvn -e cargo:start
  [INFO] Error stacktraces are turned on.
  [INFO] Scanning for projects...
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building projectID 1.0
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- cargo-maven2-plugin:1.4.3:start (default-cli) @ projectID ---
  [INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:car
  go-core-container-glassfish:jar:1.4.3 for container glassfish4x
  [INFO] [talledLocalContainer] GlassFish 4.x starting...
  [INFO] [talledLocalContainer] Attempting to start domain1.... Please look at the
   server log for more details.....
  [INFO] [talledLocalContainer] Authentication failed for user: admin
  [INFO] [talledLocalContainer] with password from password file: C:/glassFishV4/g
  lassfish4/glassfish/domains/password.properties
  [INFO] [talledLocalContainer] (Usually, this means invalid user name and/or pass
  word)
  [INFO] [talledLocalContainer] Command deploy failed.
  [INFO] [talledLocalContainer] GlassFish 4.x is stopping...
  [INFO] [talledLocalContainer] Waiting for the domain to stop .
  [INFO] [talledLocalContainer] Command stop-domain executed successfully.
  [INFO] [talledLocalContainer] GlassFish 4.x is stopped
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 22.139s
  [INFO] Finished at: Fri Aug 16 16:19:33 EDT 2013
  [INFO] Final Memory: 12M/304M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:star
  t (default-cli) on project projectID: Execution default-cli of goal org.codehaus.c
  argo:cargo-maven2-plugin:1.4.3:start failed: Failed to start the GlassFish 4.x c
  ontainer. At least one GlassFish deployment has failed: org.codehaus.cargo.util.
  CargoException: GlassFish admin command failed: asadmin exited 1 -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
  rg.codehaus.cargo:cargo-maven2-plugin:1.4.3:start (default-cli) on project projectID
  : Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:s
  tart failed: Failed to start the GlassFish 4.x container.
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:224)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
  ild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
  eStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
          at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
          at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
  java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
  sorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
  cher.java:290)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
  a:230)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
  uncher.java:414)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
  357)
  Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-c
  li of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:start failed: Failed to
  start the GlassFish 4.x container.
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
  BuildPluginManager.java:115)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:208)
          ... 19 more
  Caused by: org.codehaus.cargo.container.ContainerException: Failed to start the
  GlassFish 4.x container.
          at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(Abstrac
  tLocalContainer.java:230)
          at org.codehaus.cargo.maven2.ContainerStartMojo.executeLocalContainerAct
  ion(ContainerStartMojo.java:96)
          at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStart
  Mojo.java:63)
          at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo
  .java:432)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
  BuildPluginManager.java:106)
          ... 20 more
  Caused by: org.codehaus.cargo.util.CargoException: At least one GlassFish deploy
  ment has failed: org.codehaus.cargo.util.CargoException: GlassFish admin command
   failed: asadmin exited 1
          at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
  alledLocalContainer.doStart(AbstractGlassFishInstalledLocalContainer.java:193)
          at org.codehaus.cargo.container.spi.AbstractInstalledLocalContainer.star
  tInternal(AbstractInstalledLocalContainer.java:313)
          at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(Abstrac
  tLocalContainer.java:211)
          ... 24 more
  Caused by: org.codehaus.cargo.util.CargoException: GlassFish admin command faile
  d: asadmin exited 1
          at org.codehaus.cargo.container.glassfish.internal.GlassFish3xAsAdmin.in
  vokeAsAdmin(GlassFish3xAsAdmin.java:88)
          at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
  alledLocalContainer.invokeAsAdmin(AbstractGlassFishInstalledLocalContainer.java:
  96)
          at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
  alledLocalContainer.invokeAsAdmin(AbstractGlassFishInstalledLocalContainer.java:
  69)
          at org.codehaus.cargo.container.glassfish.GlassFish3xInstalledLocalDeplo
  yer.doDeploy(GlassFish3xInstalledLocalDeployer.java:89)
          at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
  alledLocalDeployer.redeploy(AbstractGlassFishInstalledLocalDeployer.java:97)
          at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
  alledLocalContainer.doStart(AbstractGlassFishInstalledLocalContainer.java:174)
          ... 26 more
  [ERROR]
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please rea
  d the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
  nException
  </code></pre>
  
  <p>The weird thing is, is that I can see it start the glassfish server through eclipse and then stop it. I also tried with no password and user name for defaults because that's what they are, and as you see in this configuration I use a username and password file as described on the cargo site. I receive the same error both times. </p>