备忘Document root element "beans",must match DOCTYPE root "null"
2016-02-03 18:39
295 查看
原因在网上一搜一大堆,比如这篇 http://seenow.blog.hexun.com/19253270_d.html。
转帖如下:
遇到一个新问题,ssh项目部署时遇到Document root element "beans", must match DOCTYPE root "null".的错误提示,网上很多人说要把applicationContex.xml文件中加上如下第二行的<!DOCTYPE/>标签,说明DTD,其实并不准确。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
……
</beans>
后来在spring forum上发现了正解:
You have the wrong xml configuration for the version of spring.
1.x use DOCTYPE
2.x use schema
You must have 1.x in the classpath.
引自http://forum.springframework.org/showthread.php?t=37883
现在明白了,spring 1.x 使用DOCTYPE,而2.x是用schema,我的项目出错原因是由于前面的其他错误怀疑spring版本问题把spring2.0换成了spring1.2,但applicationContex.xml还是使用
<?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"> 更换spring为2.0问题解决。
==============转帖完毕========我是华丽的分割线============================
在使用maven的过程中如果引入了非常多的依赖导致即使找到了spring1.x的包也不知道是哪个依赖引进来的,这个时候有个小技巧:
1、点开“Maven Dependencies”
2、找出spring1.x的包
3、点击右键 --> MAVEN --> Exclude Maven artifact --> 点OK --> done
通过以上三步,可以很轻松的让Maven自动帮你去掉相应依赖中spring1.x的引入。如下所示:
转帖如下:
遇到一个新问题,ssh项目部署时遇到Document root element "beans", must match DOCTYPE root "null".的错误提示,网上很多人说要把applicationContex.xml文件中加上如下第二行的<!DOCTYPE/>标签,说明DTD,其实并不准确。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
……
</beans>
后来在spring forum上发现了正解:
You have the wrong xml configuration for the version of spring.
1.x use DOCTYPE
2.x use schema
You must have 1.x in the classpath.
引自http://forum.springframework.org/showthread.php?t=37883
现在明白了,spring 1.x 使用DOCTYPE,而2.x是用schema,我的项目出错原因是由于前面的其他错误怀疑spring版本问题把spring2.0换成了spring1.2,但applicationContex.xml还是使用
<?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"> 更换spring为2.0问题解决。
==============转帖完毕========我是华丽的分割线============================
在使用maven的过程中如果引入了非常多的依赖导致即使找到了spring1.x的包也不知道是哪个依赖引进来的,这个时候有个小技巧:
1、点开“Maven Dependencies”
2、找出spring1.x的包
3、点击右键 --> MAVEN --> Exclude Maven artifact --> 点OK --> done
通过以上三步,可以很轻松的让Maven自动帮你去掉相应依赖中spring1.x的引入。如下所示:
<dependency> <groupId>xbean</groupId> <artifactId>xbean-spring</artifactId> <version>2.1</version> <exclusions> <exclusion> <artifactId>spring</artifactId> <groupId>org.springframework</groupId> </exclusion> </exclusions> </dependency>
相关文章推荐
- 备忘启动jetty后log中不断交替出现Connector vm://localhost Started/Stopped
- [Spring实战系列](7)Spring注入方式之构造器注入
- Python实现LR(逻辑回归)
- Jenkins进阶系列之——11修改Jenkins用户的密码
- Nginx出现413 Request Entity Too Large错误解决方法
- 115. Distinct Subsequences
- 陶哲轩实分析 2.3节 习题试解
- Jenkins进阶系列之——10Publish Over SSH插件
- Xcode 6制作动态及静态Framework
- symfony2 外键 OneToMany
- 陶哲轩 实分析 第二章第三小节 习题解答
- TabHost详解
- 2016年1月19日-2月3日课程作业
- Jenkins进阶系列之——09配置Linux系统ssh免密码登陆
- UIWebView的使用方法
- hql不能使用Limit的解决方法
- Troubleshoot Utility 1:UCP无法获取Managed Instance的Resouce Utility data --未解决
- HDU 2209 翻纸牌游戏(DFS)
- MAC开发环境搭建
- Jenkins进阶系列之——08Jenkins纳入版本控制