警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcContentNegotiationManager': Failed to introspect bean class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext
缺少servlet-api的依赖包
<dependency>
<groupId>tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>5.5.23</version>
</dependency>
本文解决了一个关于Spring MVC中因缺乏servlet-api依赖导致的Exception错误。通过添加正确的Maven依赖项解决了ClassNotFoundException的问题。
4393

被折叠的 条评论
为什么被折叠?



