java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig 原因分析与解决方案

Spring4单元测试出现错误:

java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig


原因分析:

Spring4 与servlet2.5兼容性问题


解决方案:

pom.xml中添加servlet 3.0.1, scope填写test,artifactId为javax.sevlet-api

 <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>test</scope>
</dependency>

猜你喜欢

转载自huanggua12353719.iteye.com/blog/2311016