I'm using cargo-maven2-plugin to run tomcat for integration tests. It worked fine when 7x container is used. I recently upgraded it to 9x and it works fine on a Ubuntu/Linux machine but doesn't work on a Mac (running the latest OS version).
When I peek into the container logs it lists the following logs:
Error: Could not find or load main class org.apache.catalina.startup.Bootstrap
Listening for transport dt_socket at address: 7998
Error: Could not find or load main class org.apache.catalina.startup.Bootstrap
When I peek into the cargo logs it lists the following logs:
The ' characters around the executable and arguments are
not part of the command.
[10:46:34.640][debug][talledLocalContainer] +Task: java
[10:46:34.642][debug][talledLocalContainer] dropping /Users/myprojectpath/target/tomcat-9.0.22/bin/tomcat-juli.jar from path as it doesn't exist
[10:46:34.642][debug][talledLocalContainer] dropping /Users/myprojectpath/target/tomcat-9.0.22/bin/bootstrap.jar from path as it doesn't exist
[10:46:34.643][debug][talledLocalContainer] dropping /Users/myprojectpath/target/tomcat-9.0.22/bin/tomcat-juli.jar from path as it doesn't exist
[10:46:34.643][debug][talledLocalContainer] dropping /Users/myprojectpath/target/tomcat-9.0.22/bin/bootstrap.jar from path as it doesn't exist
[10:46:34.643][debug][talledLocalContainer] Executing '/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/bin/java' with arguments:
'-Xdebug'
'-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7998'
'-DprocessName=central'
'-Xms256m'
'-Xmx512m'
'-Dfile.encoding=utf-8'
'-Dhsqldb.database=/Users/myprojectpath/target/tomcat-9.0.22/tomcat/hsqldb/myprojectdbname'
'-Dhsqldb.dbname=myprojectdbname'
'-Dhsqldb.port=9001'
'-Duser.language=en'
'-Dcatalina.home=/Users/myprojectpath/target/tomcat-9.0.22'
'-Dcatalina.base=/Users/myprojectpath/target/tomcat-9.0.22/tomcat'
'-Djava.io.tmpdir=/Users/myprojectpath/target/tomcat-9.0.22/tomcat/temp'
'-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager'
'-Djava.util.logging.config.file=/Users/myprojectpath/target/tomcat-9.0.22/tomcat/conf/logging.properties'
'-classpath'
'/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/lib/tools.jar'
'org.apache.catalina.startup.Bootstrap'
'start'
Here's the configuration/setup for the plugin:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<configuration>
<properties>
<cargo.wait>false</cargo.wait>
<cargo.jvmargs>${jvm.debug.options} -DprocessName=central -Xms256m -Xmx512m -Dfile.encoding=utf-8 -Dhsqldb.database=${catalina.home}/hsqldb/myprojectdbname -Dhsqldb.dbname=myprojectdbname -Dhsqldb.port=9001 -Duser.language=en</cargo.jvmargs>
</properties>
</configuration>
<deployables>
....
</deployables>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>package</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<profile>
<id>tomcat9x</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<artifactInstaller>
<groupId>com.mycomapany.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${catalina.version}</version>
<type>zip</type>
<extractDir>${project.build.directory}</extractDir>
</artifactInstaller>
<output>${project.build.directory}/container.log</output>
<append>false</append>
<log>${project.build.directory}/cargo.log</log>
<timeout>600000</timeout>
</container>
<configuration>
<type>existing</type>
<home>${catalina.home}</home>
<properties>
<cargo.servlet.port>${catalina.port}</cargo.servlet.port>
<cargo.logging>high</cargo.logging>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<catalina.port>12345</catalina.port>
<catalina.home>${project.build.directory}/tomcat-${catalina.version}/tomcat</catalina.home>
<jvm.debug.options>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7998</jvm.debug.options>
</properties>