您的位置:首页 > 编程语言 > Java开发

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

2017-04-14 15:15 561 查看
fire自带的包下有个spring1.2.6的jar包,而工程的jar包是2.0的。

解决方案:

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

[java] view plain copy

<?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">
<bean id="helloWS" class="com.HelloWorld"/>

<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>

<bean name="helloService" class="org.codehaus.xfire.spring.ServiceBean">

<property name="serviceBean" ref="helloWS"/>

<property name="serviceClass" value="com.IHelloWorld"/>

<property name="inHandlers"><list><ref bean="addressingHandler"/></list></property>

</bean>

</beans>

改成:

[java] view plain copy

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<beans>

<bean id="helloWS" class="com.HelloWorld"/>

<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler"/>

<bean name="helloService" class="org.codehaus.xfire.spring.ServiceBean">

<property name="serviceBean" ref="helloWS"/>

<property name="serviceClass" value="com.IHelloWorld"/>

<property name="inHandlers"><list><ref bean="addressingHandler"/></list></property>

</bean>

</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>

重新发布即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐