Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)

最近写java项目打包成可执行jar时项目测试运行正常,但是当定时执行该项目时有时候会报错

org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 111; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
通过上网查找发现并不是我一个人出现这个错误,很多大神也都有这个错误。通过分析和参考大神们的文章。得出的解决办法是让spring加载本地的 xsd文件。当然得你的包里包含你需要加载的xsd文件。spring的jar包,一般都会包含之前版本的jar包,例如我用的spring版本为4.2.6.RELEASE它里面应该就会包含 4点几,3点几,和2点几的xsd文件,还有maven打包插件最好使用 maven-shade-plugin

参考文章

https://blog.csdn.net/wangjunjun2008/article/details/51425250

https://blog.csdn.net/fu250/article/details/78043901

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值