Tomcat 使用 cargo maven 启动组件失败

Tomcat Failed to start component using cargo maven

我正在尝试将 war 文件部署到 tomcat,使用端口 8080 上的 cargo maven 插件(我检查过,这是免费的),我得到 catalina.LifeCycleException: Failed to start component [Connector[AJP/1.3-auto-1]]

它还说输入的端口号无效,但在 server.xml 文件中端口指定为:<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

我是否遗漏了一些其他配置?

货物配置:

<plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.14</version>
            <configuration>
                <container>
                    <containerId>tomcat8x</containerId>
                    <type>installed</type>
                    <zipUrlInstaller>
                        <url>http://repo.release.cerner.corp/external/repo/org/apache/tomcat/apache-tomcat/${apache.tomcat.version}/apache-tomcat-${apache.tomcat.version}.tar.gz</url>
                    </zipUrlInstaller>
                    <dependencies>
                        <dependency>
                            <groupId>com.oracle</groupId>
                            <artifactId>ojdbc6</artifactId>
                        </dependency>
                    </dependencies>
                    <timeout>300000</timeout>
                </container>
                <configuration>
                    <configfiles>
                        <configfile>
                            <file>${project.basedir}/src/test/resources/context/context.xml</file>
                            <todir>conf</todir>
                        </configfile>
                    </configfiles>
                    <properties>
                        <cargo.servlet.port>${apache.tomcat.servletPort}</cargo.servlet.port>
                        <cargo.rmi.port>${apache.tomcat.rmiPort}</cargo.rmi.port>
                        <cargo.tomcat.ajp.port>${apache.tomcat.ajpPort}</cargo.tomcat.ajp.port>
                        <cargo.logging>low</cargo.logging>
                        <!--uncomment to enable debugging on the server-->
                        <!--<cargo.jvmargs> "-Xdebug" "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7998"-->
                        <!--</cargo.jvmargs>-->
                    </properties>
                </configuration>
                <deployables>
                    <deployable>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>sample-war</artifactId>
                        <type>war</type>
                        <properties>
                            <context>sample-war</context>
                        </properties>
                    </deployable>
                </deployables>
            </configuration>
            <executions>
                <execution>
                    <id>start-container</id>
                    <goals>
                        <goal>start</goal>
                    </goals>
                    <phase>pre-integration-test</phase>
                </execution>
                <execution>
                    <id>stop-container</id>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                    <phase>post-integration-test</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>

更改 cargo configuration 中的端口号:

<configuration>
      <properties>
        <cargo.servlet.port>8080</cargo.servlet.port>
      </properties>
    </configuration>

或者在命令行上覆盖它

mvn -Dcargo.servlet.port=8080 cargo:start

在您的 HTTP 连接器旁边,您在 server.xml 中配置了一个 AJP 连接器元素,并指定了端口 -1:

<Connector
  port="-1"
  protocol="AJP/1.3"
  ...
/>

如果您不需要 AJP,请将此连接器包含在 <!-- --> 评论元素中以将其注释掉。否则您需要更正端口设置才能使用 AJP。

或者您可能需要使用 cargo 属性:

指定 AJP

cargo.tomcat.ajp.port