Reputation: 1985
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?
Upvotes: 0
Views: 2071
Reputation: 19496
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
Upvotes: 0
Reputation: 4114
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>
Upvotes: 1