cvc-elt.1:找不到元素'beans'-dispatcher-servlet.xml

时间:2016-02-12 01:25:59

标签: java xml spring spring-mvc servlets

我正在尝试运行一个SPRING MVC应用程序。但是,它在“dispatcher-servlet.xml”文件中抛出了有关Bean Definition Exception的异常。

下面附上了我的dispatcher-servlet.xml文件

 <beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context" 
  xmlns:mvc="http://www.springframework.org/schema/mvc" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schem...-beans-3.0.xsd
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schem...ontext-3.0.xsd
  http://www.springframework.org/schema/mvc  
  http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

  <bean class="org.springframework.web.servlet.mvc.support.
   ControllerClassNameHandlerMapping"/>
 <context:annotation-config />
 <context:component-scan base-package="com.atm.controller"  />
 <mvc:annotation-driven />

 <bean id="viewResolver"

  class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

</beans>

正在

创建错误
  "http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">"  
   columnNumber: 64; cvc-elt.1: Cannot find the declaration of element   
  'beans'.

Stack Trace如下:

type Exception report
message Servlet.init() for servlet dispatcher threw exception
description The server encountered an internal error that prevented it from  
fulfilling this request.
exception 
javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw  
exception
Root cause: 

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line   
27  in XML document from ServletContext resource [/WEB-INF/dispatcher- 
servlet.xml]  is invalid; nested exception is org.xml.sax.SAXParseException;  
lineNumber: 27; 
columnNumber: 64; cvc-elt.1: Cannot find the declaration of element 'beans'.
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefi
nitions(XmlBeanDefinitionReader.java:396)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefin    
itions(XmlBeanDefinitionReader.java:334)

任何帮助都会受到高度赞赏。

0 个答案:

没有答案