title: Anyone know how to customize the servlet port for an embedded JBoss container using Maven Cargo?
body: <p>I"m using Maven 3.0.3 with the Cargo 1.3.3 plugin.  I'm trying to configure an embedded JBoss 7.1 container.  I would like to customize the port on which JBoss listens for requests, normally 8080.  However, I can't seem to customize it, using the "cargo.servlet.port" property in the configuration section.  Below is my configuration</p>
  
  <pre><code>                &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.3.3&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;home&gt;${project.build.directory}/jboss-${jboss.version}/container&lt;/home&gt;
                          &lt;properties&gt;
                              &lt;cargo.logging&gt;high&lt;/cargo.logging&gt;
                              &lt;cargo.servlet.port&gt;${jboss.servlet.port}&lt;/cargo.servlet.port&gt;
                          &lt;/properties&gt;
                          &lt;container&gt;
                              &lt;containerId&gt;jboss${jboss.major}x&lt;/containerId&gt;
                              &lt;zipUrlInstaller&gt;
                                  &lt;url&gt;http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip&lt;/url&gt;
                                  &lt;downloadDir&gt;${project.basedir}/downloads&lt;/downloadDir&gt;
                                  &lt;extractDir&gt;${project.build.directory}/extracts&lt;/extractDir&gt;
                              &lt;/zipUrlInstaller&gt;
                              &lt;output&gt;${project.build.directory}/jboss${jboss.major}x.log&lt;/output&gt;
                              &lt;log&gt;${project.build.directory}/cargo.log&lt;/log&gt;
                          &lt;/container&gt;
                          &lt;deployables&gt;
                              &lt;deployable&gt;
                                  &lt;location&gt;target/${project.artifactId}.${project.packaging}&lt;/location&gt;
                                  &lt;pingURL&gt;http://localhost:${jboss.servlet.port}/${project.artifactId}&lt;/pingURL&gt;
                                  &lt;pingTimeout&gt;60000&lt;/pingTimeout&gt;
                                  &lt;properties&gt;
                                      &lt;context&gt;${project.artifactId}&lt;/context&gt;
                                  &lt;/properties&gt;
                              &lt;/deployable&gt;
                          &lt;/deployables&gt;
                      &lt;/configuration&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;start-container&lt;/id&gt;
                              &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;start&lt;/goal&gt;
                                  &lt;goal&gt;deploy&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                          &lt;execution&gt;
                              &lt;id&gt;stop-container&lt;/id&gt;
                              &lt;phase&gt;post-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;stop&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
  </code></pre>
  
  <p>Here is the bind exception I get in the application server log (I already have a JBoss instance running on port 8080).   </p>
  
  <pre><code>16:45:41,913 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-10) JBoss Web Services - Stack CXF Server 4.0.2.GA
  16:45:42,010 ERROR [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-3) Error initializing endpoint: java.net.BindException: Address already in use /0.0.0.0:8080
      at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:983) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:190) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.connector.Connector.init(Connector.java:983) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.as.web.WebConnectorService.start(WebConnectorService.java:267) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_41]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_41]
      at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_41]
  
  16:45:42,025 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.web.connector.http: org.jboss.msc.service.StartException in service jboss.web.connector.http: JBAS018007: Error starting web connector
      at org.jboss.as.web.WebConnectorService.start(WebConnectorService.java:271)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_41]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_41]
      at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_41]
  Caused by: LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use /0.0.0.0:8080
      at org.apache.catalina.connector.Connector.init(Connector.java:985)
      at org.jboss.as.web.WebConnectorService.start(WebConnectorService.java:267)
      ... 5 more
  </code></pre>
  
  <p>The reason I like the Cargo plugin is it allows me to use my own JBoss standalone.xml configuration, but am open to alternatives to Cargo, provided I can customize my config.  Thanks for any guidance, - Dave</p>