【问题标题】:Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc找不到 XML 模式命名空间的 Spring NamespaceHandler [http://www.springframework.org/schema/mvc
【发布时间】:2014-10-06 19:17:59
【问题描述】:

我正在尝试使用 Spring 4 和 Jackson 实现 Web 服务。 当我部署应用程序时,我收到以下错误:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc]
Offending resource: class path resource [namaservlet-servlet.xml]

这是我的 namaservlet-context.xml :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">

  <mvc:annotation-driven>
    <mvc:message-converters>
      <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
        <property name="objectMapper">
          <bean class="utils.HibernateAwareObjectMapper" />
        </property>
      </bean>
    </mvc:message-converters>
  </mvc:annotation-driven>

</beans>

我该如何解决这个问题?

谢谢

【问题讨论】:

    标签: java xml spring spring-mvc jackson


    【解决方案1】:

    stracktrace 表明您在类路径中缺少 spring-webmvc jar。添加它,它应该可以正常工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-21
      • 2013-11-01
      • 2011-11-03
      • 2014-04-19
      • 2015-12-05
      • 1970-01-01
      • 2012-02-05
      • 2013-11-06
      相关资源
      最近更新 更多