java - Extending classpath and Tomcat Plugin -
the project working @ moment standard web application , want start embedded tomcat (mvn tomcat7:run). within meta-inf/context.xml there entry
<loader classname="org.apache.catalina.loader.virtualwebapploader" virtualclasspath="${home}/lib"/>
to extend classpath of web application.
when starting web application mvn tomcat7:run lot of classnotfoundexceptions, e.g.
java.lang.classnotfoundexception: org.apache.catalina.deploy.servletdef
are thrown.
is there way embedded tomcat tomcat plugin work while extending classpath in context.xml?
the answer problem set tomcat plugin use separate class loader maven. done setting useseparatetomcatclassloader
parameter plugin true. can either done in tomcat plugin configuration:
<plugin> <groupid>org.apache.tomcat.maven</groupid> <artifactid>tomcat7-maven-plugin</artifactid> <configuration> <contextreloadable>true</contextreloadable> <useseparatetomcatclassloader>true</useseparatetomcatclassloader> </configuration> </plugin>
or on command line used start tomcat plugin:
mvn tomcat7:run -dtomcat.useseparatetomcatclassloader=true
see: http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/run-mojo.html
Comments
Post a Comment