异常信息:
- Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
- Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "beans".

解决方案 »

  1.   

    [/WEB-INF/applicationContext.xml]
    这个文件里面
    是以<beans></beans>
    这种格式 来写关于数据库及spring相关信息的,你看一下,你这个配置文件的结尾处是否有</beans>
      

  2.   


    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    </beans>
    红色那一句提示出错
      

  3.   

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <beans xmlns=”http://www.springframework.org/schema/beans” 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-2.0.xsd”>引入xsd,并且版本跟你用的一致
      

  4.   

    这个也有可能,另外你看下你项目发布后的目录是否正确,applicationContext.xml文件是否在WEB-INF下。
      

  5.   

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">换这个试试!
      

  6.   

    applicationContext.xml里面的xmlns属性有问题,再检查检查!
      

  7.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        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.xsd">把你配置文件的题头换一下,看看还有没有错。
      

  8.   

    我不得不说这是一个很诡异的问题
    刚才包myeclipse搞崩了
    结果重启了以后  就不报错了
    谢谢大家这么热心
      

  9.   

    实在没办法时,重启IDE或pc,有时也很有用啊。
      

  10.   

    去spring的source文件里面找一个simple的demo解压war文件,里面会有applicationcontext.xml文件的,你copy那里面的DTD(或称作Schema)的东西,拿过来用就Ok了啊。