我在尝试在 Weblogic 10.3.6 服务器上部署 war 文件时遇到以下异常。
该应用程序正在使用 SPring mvc。
加载DispatcherServlet的默认策略类时出错[org.springframework.web.servlet.mvc.support.Def
接口(interface) [org.springframework.web.servlet.HandlerExceptionResolver] 的 aultHandlerExceptionResolver]:类文件或依赖类存在问题;嵌套异常是
java.lang.NoClassDefFoundError: org/springframework/web/bind/MethodArgumentNotValidException
在 org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:766)
在org.springframework.web.servlet.DispatcherServlet.initHandlerExceptionResolvers(DispatcherServlet.java:604)
在 org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:423)
在org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:410)
在 org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:752)
在 org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:989)
在 org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1)
在org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
在org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:97)
在 org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
在org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
在 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
在org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:929)
在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
最佳答案
您的类路径没有 spring-web-x.x.x.jar
,这就是异常的原因。请使用 Maven 构建工具来构建您的 Spring MVC 项目。在 pom.xml 中添加所有必要的依赖项。对于 spring-web 3.0.4 版本,它将是
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
关于java - 加载DispatcherServlet的默认策略类时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20266854/