添加 xfire-all-1.2.6.jar 导致的spring配置文件异常

添加 xfire-all-1.2.6.jar 导致的spring配置文件错误

  1. 环境
    maven
    spring-3.2.3
    xfire-1.2.6

  2. 问题描述
    在工程中的 pom.xml 中添加 xfire

<dependency>
    <groupId>org.codehaus.xfire</groupId>
    <artifactId>xfire-all</artifactId>
    <version>1.2.6</version>
</dependency>

只是添加了这个jar包,其他配置文件都没动,启动tomcat,报了如下的错误:
Line 8 in XML document from class path resource [applicationContext.xml] is invalid;
nested exception is org.xml.sax.SAXParseException:
Document root element “beans”, must match DOCTYPE root “null”.

查看工程的 Java Build Path 中的 Maven Dependencies 发现多了个 spring 的jar包:

spring-1.2.6.jar

工程中的 spring 用的版本是 3.2.3 的,而这个多出来的 spring 版本是 1.2.6 的,造成了 jar 包冲突。
用压缩软件打开 xfire-all-1.2.6.jar ,在其目录 META-INF\maven\org.codehaus.xfire\xfire-jms 的 pom.xml 中发现:

<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
</dependency>

只需要将这个 spring-1.2.6.jar 从工程中删除即可。
但是发现,在 Maven Dependencies 中根本删除不了。
了解到,这个 spring-1.2.6.jar 是依赖于 xfire-all-1.2.6 的,故而,在 工程的 pom.xml 中,将这个依赖关系去掉即可— 加上

<dependency>
    <groupId>org.codehaus.xfire</groupId>
    <artifactId>xfire-all</artifactId>
    <version>1.2.6</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>1.2.6</version>
        </exclusion>
    </exclusions>
</dependency>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值