我正在使用Maven 3.0.3和Cargo 1.3.3插件。我正在尝试配置一个嵌入式JBoss 7.1容器。我想自定义JBoss侦听请求的端口,通常是8080.但是,我似乎无法使用配置部分中的“cargo.servlet.port”属性对其进行自定义。以下是我的配置
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<home>${project.build.directory}/jboss-${jboss.version}/container</home>
<properties>
<cargo.logging>high</cargo.logging>
<cargo.servlet.port>${jboss.servlet.port}</cargo.servlet.port>
</properties>
<container>
<containerId>jboss${jboss.major}x</containerId>
<zipUrlInstaller>
<url>http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip</url>
<downloadDir>${project.basedir}/downloads</downloadDir>
<extractDir>${project.build.directory}/extracts</extractDir>
</zipUrlInstaller>
<output>${project.build.directory}/jboss${jboss.major}x.log</output>
<log>${project.build.directory}/cargo.log</log>
</container>
<deployables>
<deployable>
<location>target/${project.artifactId}.${project.packaging}</location>
<pingURL>http://localhost:${jboss.servlet.port}/${project.artifactId}</pingURL>
<pingTimeout>60000</pingTimeout>
<properties>
<context>${project.artifactId}</context>
</properties>
</deployable>
</deployables>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
这是我在应用程序服务器日志中获得的绑定异常(我已经在端口8080上运行了一个JBoss实例)。
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
我喜欢Cargo插件的原因是它允许我使用我自己的JBoss standalone.xml配置,但我可以选择Cargo,只要我可以自定义我的配置。感谢任何指导, - 戴夫
答案 0 :(得分:0)
您的配置中似乎只有一个小错误。这些属性是Cargo配置的一部分,它是插件配置的子/属性,因此实际上,您必须在配置标记中放置配置标记。这是我的(部分):
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<container>
<!-- Add your container here, we use a custom one -->
</container>
<configuration>
<properties>
<cargo.servlet.port>5556</cargo.servlet.port>
<!-- other properties -->
</properties>
<configfiles combine.children="append">
<!-- here we add our configuration files -->
<configfile>
<!-- Expect configfiles to be filtered and gathered in
target/jboss71x (in the respective subdirectories) -->
<file>${project.build.directory}/cargo/jboss71x</file>
</configfile>
</configfiles>
</configuration>
</configuration>
</plugin>