spring 异常:"beans": must match DOCTYPE root "null"
今天在用spring的时候,服务器启动的时候,一直在报:org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null"的异常。一直没出现过。想了下应该是集成了xfire1.2版本。。但是将配置改过来改过去就是没用。。
网上搜索,说是spring1.x和2.x版本不兼容的问题。后来就到tomcat的部署目录的lib下查看一下,发现就是还有一个spring的1.2.6的jar包,这个jar是通过xfire导入的。想着我的配置文件的DTD是2.5,所以就把spring1.2.6版本的jar包删除,ok了。
?
因为里面还有一个webservice的配置,所以还在报错:
?
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognizedxbean element mapping: beans in namespace http://xfire.codehaus.org/config/1.0
?
又查了下,新的spring2.x功能中不允许将在根节点配置属性,需要将要配置的属性移到service节点。
修改services.xml 文件即可
?
<?xml version="1.0" encoding="UTF-8"?><beans><service xmlns="http://xfire.codehaus.org/config/1.0"><name>helloService</name><namespace>WebService</namespace><serviceClass>seeeyou.app.webservice.HelloService</serviceClass></service></beans>
?