最近写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