我不知道出了什么问题。
我会将这些消息来源和建议附在我身上,为什么会发生错误..
的pom.xml
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.8.RELEASE</version>
</dependency>
这是错误代码
org.springframework.beans.factory.BeanInitializationException: Error loading DispatcherServlet's default strategy class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver] for interface [org.springframework.web.servlet.HandlerExceptionResolver]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/annotation/SynthesizingMethodParameter
at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:830)
at org.springframework.web.servlet.DispatcherServlet.initHandlerExceptionResolvers(DispatcherServlet.java:669)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:489)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:806)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1121)
at
我不知道为什么会收到错误。
请让我知道如何解决问题。
答案 0 :(得分:1)
您需要在pom.xml中为spring-core添加依赖项。以下片段应该可以解决您的问题:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.8.RELEASE</version>
</dependency>
答案 1 :(得分:1)
有一个NoClassDefFoundError
我想你没有包含spring-core
。以下是应该添加到pom.xml
的缺失依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.8.RELEASE</version>
</dependency>