spring整合xfire出现Document root element "beans", must match DOCTYPE root "null"错误解决方案

fire自带的包下有个spring1.2.6的jar包,而工程的jar包是2.0的。

解决方案:

1.将原配置文件的头schema方式换为DOCTYPE方式,原配置文件如下(非maven)

 

[java] view plain copy
 
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <beans  
  3.     xmlns="http://www.springframework.org/schema/beans"  
  4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  5.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">  
  6.   
  7.     <bean id="helloWS" class="com.HelloWorld"/>  
  8.     <bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>  
  9.     <bean name="helloService" class="org.codehaus.xfire.spring.ServiceBean">  
  10.         <property name="serviceBean" ref="helloWS"/>  
  11.         <property name="serviceClass" value="com.IHelloWorld"/>  
  12.         <property name="inHandlers"><list><ref bean="addressingHandler"/></list></property>  
  13. </bean>  
  14.   
  15. </beans>  

 

 

改成:

 

[java] view plain copy
 
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">  
  3. <beans>  
  4.   
  5.     <bean id="helloWS" class="com.HelloWorld"/>  
  6.     <bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>  
  7.       
  8.     <bean name="helloService" class="org.codehaus.xfire.spring.ServiceBean">  
  9.         <property name="serviceBean" ref="helloWS"/>  
  10.         <property name="serviceClass" value="com.IHelloWorld"/>  
  11.         <property name="inHandlers"><list><ref bean="addressingHandler"/></list></property>  
  12. </bean>  
  13.   
  14. </beans>  

 

2.maven环境下建pom.xml的xfire调整以下:

<!-- xfire 1.2.6 -->
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-spring</artifactId>
<version>1.2.6</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>

重新发布即可

posted on 2017-04-14 15:15  antyi  阅读(1160)  评论(0编辑  收藏  举报

导航