XML加载遇到的问题

刚又遇到个问题,浪费半天时间

问题描述起来很简单,lihui-consumer.xml是我消费者的xml,dubbo-common.xml是公用公共的xml,在lihui-consumer.xml里有一行import

<import resource="dubbo-common.xml"/>

这两个xml在同一个目录下,比如main/resources/config/dubboSource下

在Build过程中,在target/classes/config/dubboSource下并没有翻译出dubbo-common.xml,但是是有lihui-consumer.xml的

完整错误信息

 
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [dubbo-common.xml]
Offending resource: URL [file:/Users/lihui/mysterious/target/classes/config/dubboSource/lihui-consumer.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file:/Users/lihui/mysterious/target/classes/config/dubboSource/dubbo-common.xml]; nested exception is java.io.FileNotFoundException: /Users/lihui/mysterious/target/classes/config/dubboSource/dubbo-common.xml (No such file or directory)

第一感觉clean,rebuild一下,没效果

接着把xml里面的import换成绝对路径

<import resource="/config/dubboSource/dubbo-common.xml"/>

但是还是没啥效果

最后将XML的目录Rebuild了一下,居然就好了

NewImage

解决了问题

NewImage

Target里也有了

发表评论