報錯信息:
無法讀取方案文檔 'http://www.springframework.org/schema/tx/spring-tx-3.1.xsd', 原因為 1) 無法找到文檔; 2) 無法讀取文檔; 3) 文檔的根元素不是
分析: 工程中引用了多個版本的 org.springframework:spring-tx,如3.0.5和3.1.1。 打包時會找spring-tx-3.1.xsd,但在3.0.5包中 spring.schemas 中不存在3.1版本的映射,認為本地不存在此文件,然后去公網上去查找,當遇到網絡不通或者網址暫時不能訪問的情況,便會報上述錯誤。 注:spring.schemas 中為公網和本地的映射關系,如下:
http\://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd http\://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd http\://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd http\://www.springframework.org/schema/tx/spring-tx-3.1.xsd=org/springframework/transaction/config/spring-tx-3.1.xsd http\://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.1.xsd
解決方法:
去掉重復包的引用,盡量使用同一版本