加载 DispatcherServlet 的默认策略类时出错



在Weblogic 10.3.6服务器上部署war文件时,我遇到以下异常。

该应用程序使用SPring-mvc。

Error loading DispatcherServlet's default strategy class [org.springframework.web.servlet.mvc.support.Def aultHandlerExceptionResolver] for interface [org.springframework.web.servlet.HandlerExceptionResolver]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/bind/MethodArgumentNotValidException at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:766) at org.springframework.web.servlet.DispatcherServlet.initHandlerExceptionResolvers(DispatcherServlet.java:604) at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:423) at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:410) at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:752) at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:989) at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1) at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51) at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:97) at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:929) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)

您的类路径没有spring-web-x.x.x.jar,这就是异常的原因。请使用Maven构建工具来构建您的Spring MVC项目。在pom.xml中添加所有必要的依赖项。对于springweb 3.0.4版本,它将是

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.0.4.RELEASE</version>
</dependency>

相关内容

最新更新