tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Johnson <alexjohn...@expedia.com>
Subject tomcat7-maven-plugin using standardjarscanner instead of webappclassloader
Date Thu, 05 Feb 2015 04:13:16 GMT
Original question here:  http://stackoverflow.com/questions/28181602/whats-the-difference-between-webappclassloader-and-standardjarscanner

I'm able to run my team's webapp on my local machine using the tomcat7-maven-plugin.  Unfortunately
when I attempt to do the same on the build server it breaks.  This is a blocking issue for
our team, but none of us are able to figure it out.  Nobody on Stack Overflow has been able
to help either.

Here is the tomcat7-maven-plugin configuration in our project:

<profiles>
   <!-- Version 2.2 of the Tomcat7 plugin does not support skip (version 2.3
      purportedly will). As an alternative, we will only include the Tomcat7 plugin
      and its goals in this profile which is activated by our own parameter. Once
      skip is supported we can delete this profile and move the plugin/executions
      to the main plugin category for this pom file. -->
   <profile>
      <id>start-tomcat-for-integration-tests</id>
      <activation>
         <property>
            <name>!${skipTomcat}</name>
         </property>
      </activation>
      <build>
         <plugins>
            <!-- We use this plugin to launch Tomcat and locally host the pages
               we just built so that we can run integration tests against them. Note that
               configuration for this plugin is stored inside the project itself under src/test/resources/com/MyCompany/MyOrg/MyProject/ui/automation/tomcat7/conf
               and does not require additional installation or configuration of the actual
               Tomcat application. This is done to minimize configuration efforts and avoid
               interfering with normal Tomcat operations. -->
            <plugin>
               <groupId>org.apache.tomcat.maven</groupId>
               <artifactId>tomcat7-maven-plugin</artifactId>
               <version>2.2</version>
               <configuration>
                  <ajpPort>8009</ajpPort>
                  <backgroundProcessorDelay>2</backgroundProcessorDelay>

                  <classLoaderClass>org.apache.catalina.loader.WebappClassLoader</classLoaderClass>

                  <configurationDir>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/ui/automation/tomcat7</configurationDir>
                  <contextFile>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/ui/automation/tomcat7/conf/context.xml</contextFile>
                  <contextReloadable>false</contextReloadable>
                  <fork>false</fork>
                  <hostName>localhost</hostName>
                  <httpsPort>8443</httpsPort>
                  <ignorePackaging>false</ignorePackaging>
                  <jarScanAllDirectories>true</jarScanAllDirectories>

                  <addWarDependenciesInClassloader>true</addWarDependenciesInClassloader>

                  <path>/contentmain</path>
                  <port>8080</port>
                  <serverXml>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/ui/automation/tomcat7/conf/server.xml</serverXml>

                  <!-- NOTE: 'skip' will not be implemented for Tomcat7 plugin until
                     the 2.3 release. This is a placeholder. -->
                  <skip>${skipTomcat}</skip>
                  <tomcatUsers>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/ui/automation/tomcat7/conf/tomcat-users.xml</tomcatUsers>
                  <tomcatWebXml>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/ui/automation/tomcat7/conf/web.xml</tomcatWebXml>
                  <useNaming>true</useNaming>
                  <useTestClasspath>true</useTestClasspath>
                  <update>true</update>
                  <warDirectory>${original.build.directory}/${original.build.finalName}</warDirectory>
               </configuration>
               <dependencies>
                  <dependency>
                     <groupId>org.apache.tomcat.embed</groupId>
                     <artifactId>tomcat-embed-core</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-util</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-coyote</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-api</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-jdbc</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-dbcp</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-servlet-api</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-jsp-api</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-jasper</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-jasper-el</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-el-api</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-catalina</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-tribes</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-catalina-ha</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-annotations-api</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat</groupId>
                     <artifactId>tomcat-juli</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat.embed</groupId>
                     <artifactId>tomcat-embed-logging-juli</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>org.apache.tomcat.embed</groupId>
                     <artifactId>tomcat-embed-logging-log4j</artifactId>
                     <version>${tomcat.version}</version>
                  </dependency>
                  <dependency>
                     <groupId>com.microsoft</groupId>
                     <artifactId>sqljdbc</artifactId>
                     <version>4.0</version>
                  </dependency>
               </dependencies>
               <executions>
                  <execution>
                     <id>start-tomcat</id>
                     <phase>pre-integration-test</phase>
                     <goals>
                        <goal>run-war-only</goal>
                     </goals>
                     <configuration>
                        <fork>true</fork>
                     </configuration>
                  </execution>
                  <execution>
                     <id>stop-tomcat</id>
                     <phase>post-integration-test</phase>
                     <goals>
                        <goal>shutdown</goal>
                     </goals>
                     <configuration>
                        <skip>${keepTomcatRunning}</skip>
                     </configuration>
                  </execution>
               </executions>
            </plugin>
         </plugins>
      </build>
   </profile>
</profiles>

You may note that the classLoaderClass parameter does not appear to do anything here.  I've
also noticed that the addWarDependenciesInClassLoader parameter does not appear to be supported
by the run-war-only goal (I'm not sure if this would help or not).

Worth noting:  All of the JAR files which Tomcat can't find exist on the server at the exact
location where it's claiming it can't find them.

Would somebody mind explaining why this plugin would use the StandardJarScanner on the build
server instead of the WebappClassLoader that gets used on my machine?

Thanks,

-Alex

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message