【问题标题】:Error loading DispatcherServlet's default strategy class加载 DispatcherServlet 的默认策略类时出错
【发布时间】:2013-12-14 12:49:23
【问题描述】:

我在尝试在 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)

【问题讨论】:

    标签: java spring servlets spring-mvc dispatcher


    【解决方案1】:

    您的类路径没有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>
    

    【讨论】:

    • 解决了这个问题。我正在使用 3.1.0Release jar 。但是项目中的spring jars是3.1.0.RC1版本的。
    猜你喜欢
    • 1970-01-01
    • 2021-05-05
    • 1970-01-01
    • 1970-01-01
    • 2014-09-27
    • 2020-07-21
    • 1970-01-01
    • 2021-03-12
    • 1970-01-01
    相关资源
    最近更新 更多