tomcat7-maven-plugin将上下文初始化事件发送到类org.springframework.web.context.ContextLoaderListener的侦听器实例的异常

时间:2015-06-05 19:22:01

标签: java spring maven tomcat

我正在尝试使用嵌入式tomcat7-maven-plugin为我的Web应用程序设置集成测试。

mvn install

时出现此异常
    `Jun 05, 2015 2:01:36 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: org.springframework.expression.spel.SpelParserConfiguration.<init>(Lorg/springframework/expression/spel/SpelCompilerMode;Ljava/lang/ClassLoader;)V
    at org.springframework.context.expression.StandardBeanExpressionResolver.<init>(StandardBeanExpressionResolver.java:98)
    at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Jun 05, 2015 2:01:36 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jun 05, 2015 2:01:36 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
Jun 05, 2015 2:01:36 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext

我的pom.xml看起来像:

    <parent>
        <groupId>org.platform.testpackager</groupId>
        <artifactId>testpackager-webapp-parent</artifactId>
        <version>2.22.0-SNAPSHOT</version>
    </parent>
    <artifactId>testpackager-api</artifactId>
    <name>testpackager-api</name>
    <packaging>war</packaging>
    <build>
        <finalName>testpackager-api</finalName>
        <plugins>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.18.1</version>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
        <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
            <!-- http port -->
      <port>9090</port>
      <!-- application path always starts with /-->
      <path>/</path>
            <!-- <serverXml>src/main/resources/server.xml</serverXml> -->
        </configuration>
        <executions>
      <execution>
        <id>tomcat-run</id>
        <goals>
          <goal>run-war-only</goal>
        </goals>
        <phase>pre-integration-test</phase>
        <configuration>

          <fork>true</fork>

        </configuration>
      </execution>
      <execution>
        <id>tomcat-shutdown</id>
        <goals>
          <goal>shutdown</goal>
        </goals>
        <phase>post-integration-test</phase>
      </execution>
    </executions>
</plugin>


</plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.caltesting.platform.testpackager</groupId>
            <artifactId>testpackager-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${cxf.client.version}</version>
        </dependency>
    </dependencies>
</project>

可能的原因是什么? 生成的战争在独立的tomcat中正确部署。

先谢谢。

0 个答案:

没有答案