3

I'm trying to setup Maven to start Tomcat (using Cargo) and deploy my project in preparation for integration tests.

Here is my POM:

< ... >
<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.1.3</version>
    <configuration>
        <container>
            <containerId>tomcat6x</containerId>
            <type>installed</type>
            <home>/Dev/apache-tomcat-6.0.29/</home>
        </container>
        <configuration>
            <type>existing</type>
            <home>/Dev/apache-tomcat-6.0.29/</home>
        </configuration>
    </configuration>
    <executions>
        <execution>
            <id>start</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
        <execution>
            <id>stop</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
</plugin>
< .... >

When I clean and build, it can't find Catalina.jar which is in my Tomcat /lib directory:

[talledLocalContainer] java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
[talledLocalContainer]  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[talledLocalContainer]  at java.security.AccessController.doPrivileged(Native Method)
[talledLocalContainer]  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[talledLocalContainer]  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[talledLocalContainer]  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[talledLocalContainer]  at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:216)
[talledLocalContainer]  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:391)

When running clean and build with debug enabled, it shows that it is looking for Catalina.jar in tomcat/server/lib:

[talledLocalContainer] Failed to find Tomcat version, base error [\Dev\apache-tomcat-6.0.29\server\lib\catalina.jar (The system cannot find the path specified)]
[talledLocalContainer] Parsed Tomcat version = [6.x]
[talledLocalContainer] Tomcat 6.x starting...
[talledLocalContainer] Project base dir set to:  C:\Users\Colin\Documents\NetBeansProjects\HousingWeb
[talledLocalContainer] Executing 'C:\Program Files\Java\jdk1.6.0_22\jre\bin\java.exe' with arguments:

My tomcat directory looks like this:

- apache-tomcat-6.0.29
   + bin
   + conf
   - lib
       - Catalina.jar
       - [bunch of other .jars]
   + logs
   + temp
   + webapps
   + work
   - [other files]

Why might Cargo be looking for Tomcat's lib folder under /server/lib instead of just /lib?

Is there a way to override this behavior?

UPDATE:

After looking through the different versions of Tomcat (5.5, 6.0, 7.0) it looks like the directory structure for 5.5 had /server/lib and /common/lib where 6.0 and 7.0 just have /lib.

Cargo seems to be trying to instantiate a Tomcat 5.5 app. How do I configure it to use 6.0?

Planky
  • 3,185
  • 3
  • 29
  • 39

1 Answers1

2

Do you have the same problem if you download and unzip the Tomcat instead of using yours?

<container>
    <containerId>tomcat6x</containerId>
    <zipUrlInstaller>
        <url>http://www.apache.org/dist/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.zip</url>
    </zipUrlInstaller>
</container>
  • 1
    That worked. The server starts up in Standalone mode. Interestingly, I still get these warnings where it is looking for files specific to the Tomcat 5 directory structure: `WARNING: Problem with directory [C:\Users\Colin\Documents\NetBeansProjects\HousingWeb\target\cargo\configurations\tomcat6x\common\lib], exists: [false]` – Planky Jan 05 '12 at 20:32