javatomcattomcat8cargo

Tomcat Failed to start component using cargo maven


I am trying to deploying a war file to tomcat, using cargo maven plugin on port 8080(which is free, I checked), I am getting catalina.LifeCycleException: Failed to start component [Connector[AJP/1.3-auto-1]]

Error Stack

It also says that port number entered is invalid, but in server.xml file the port is specified as : <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

Am I missing some other configuration?

Cargo Configurations:

<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>

Solution

  • Change port number in cargo configuration:

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

    Or override it on command line

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