0

I have defined tomcat:catalina:5.5.23 as a dependency to the cargo plugin, however I still get the following exception:

java.lang.ClassNotFoundException: org.apache.catalina.Connector
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.codehaus.cargo.container.tomcat.internal.Tomcat5xEmbedded.preloadEmbedded(Tomcat5xEmbedded.java:232)

It looks like the RealmClassLoader is not finding the class, possibly due to java.security.AccessController.doPrivileged denying access.

Has anyone got tomcat to run in embedded mode from within maven?

Rich Seller
  • 83,208
  • 23
  • 172
  • 177
npellow
  • 1,985
  • 1
  • 16
  • 23
  • Would you mind posting the relevant sections of your POM? The cargo config and the related dependencies should suffice. – sblundy Oct 01 '08 at 02:40
  • AFAIK, there aren't much references of cargo using the tomcat embedded implementation. This implementation has been contributed "lately", only Jetty had embedded implementation in earlier versions. You should ask your question directly on the cargo dev list. – Pascal Thivent Mar 14 '09 at 23:42

2 Answers2

1

Side note: You can start jetty which is similar to tomcat. (Servlets will be available at http://localhost:8080/ artefact-name)

mvn jetty6:run

You would have to add to your pom:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty6-plugin</artifactId>
                <configuration>
                    <scanIntervalSeconds>5</scanIntervalSeconds>
                    <!--
                    <webXml>${basedir}/WEB-INF/web.xml</webXml>
                    -->
                </configuration>
            </plugin>
         </plugins>
    </build>
</project>
Hugo
  • 4,004
  • 1
  • 31
  • 33
0

There is also a tomcat maven plugin:

http://mojo.codehaus.org/tomcat-maven-plugin/introduction.html

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
  </plugin>
</plugins>

On my machine this loads up tomcat 6. I'm not sure how to get it to work with tomcat 5.5

Nathan Feger
  • 19,122
  • 11
  • 62
  • 71