现象:

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema documen

t 'http://www.springframework.org/schema/beans/spring-beans-3.1.xsd', because 1)

 could not find the document; 2) the document could not be read; 3) the root ele

ment of the document is not <xsd:schema>.

分析: 

参考http://blog.csdn.net/bluishglc/article/details/7596118 

这篇文章分析的比较深入,具体原因为: 

根据xx.jar\META-INF\spring.schemas文件,先在本地查找相关xsd文件,如果本地没有,则通过网络去获取,实际上上面问题往往出现在没有网络的服务器上(本地正常,传到服务器上,而服务器一般是不能访问外网的) 

但该文章并没有讲清楚更具体的处理措施,只是说了最好用maven的shade打包插件而不是assembly

处理:

必须在 <transformers> 里面加上下面内容

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

    <resource>META-INF/spring.handlers</resource>

</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

    <resource>META-INF/spring.schemas</resource>

</transformer>

才会出现“shade能够将所有jar里的spring.schemas文件进行合并,在最终生成的单一jar包里,spring.schemas包含了所有出现过的版本的集合!”的效果

参考 

http://blog.csdn.net/bluishglc/article/details/7596118 

http://mapserver000-gmail-com.iteye.com/blog/1182499

http://shuhucy.iteye.com/blog/1771684

http://stackoverflow.com/questions/8523997/unable-to-locate-spring-namespacehandler-for-xml-schema-namespace-http-www-sp/8574629#8574629

http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html

http://maven.apache.org/plugins/maven-shade-plugin/

org.xml.sax.SAXParseException: Failed to read schema document 的原因分析与解决方法的更多相关文章

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

    今天配置Spring的xml出现了错误 Multiple annotations found at this line: - schema_reference.4: Failed to read sc ...

  2. pandas.read_csv() 报错 OSError: Initializing from file failed,报错原因分析和解决方法

    今天调用pandas读取csv文件时,突然报错“ OSError: Initializing from file failed ”,我是有点奇怪的,以前用的好好的,read_csv(path)方法不是 ...

  3. webServices接口开发过程中项目启动遇到的错误org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 422; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-bean

    org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 422; schema_reference.4: Failed to read ...

  4. Spring- 异常org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/context/; lineNumber: 1; columnNumber: 55; 在 publicId 和 systemId 之间需要有空格。

    抛出异常 六月 03, 2018 7:40:44 下午 org.springframework.context.support.AbstractApplicationContext prepareRe ...

  5. SpringMVC org.xml.sax.SAXParseException: cvc-complex-type.2.4.c 报错处理方式

    使用SpringMVC的过程中需要访问静态文件,即在spring-servlet.xml文件中添加了 <mvc:default-servlet-handler /> 标签,以开启Sprin ...

  6. spring-bean 版本的问题(报错:org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 75;)

    当XML中配置的xsd是4.0,而引用的包是4以下的spring-bean.jar时,当服务器能连网时没问题,不能连网时,就报以下类似错误: org.xml.sax.SAXParseException ...

  7. org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。

    二月 25, 2016 9:24:24 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRul ...

  8. nested exception is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 56; cvc-complex-type.2.4.c通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明

    严重: Exception sending context initialized event to listener instance of class org.springframework.we ...

  9. Caused by: org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 81;

    1.错误描述 严重: Exception sending context initialized event to listener instance of class org.springframe ...

随机推荐

  1. Nginx1.14.2新增tcp/udp代理stream

    [root@rhel nginx-1.12.1]# ./configure --help --help print this message --prefix=PATH set installatio ...

  2. Django:Admin,Cookie,Session

    一. Admin的配置 1.Admin基础设置 admin是django强大功能之一,它能够从数据库中读取数据,呈现在页面中,进行管理.默认情况下,它的功能已经非常强大,如果你不需要复杂的功能,它已经 ...

  3. Project Euler 8 Largest product in a series

    题意:寻找这 1000 个数中相邻 13 个数相乘积最大的值 思路:首先想到的是暴力,但是还可以利用之前记录过的数值,什么意思呢?即在计算 2 - 14 后,再计算 3 - 15 时完全可以利用之前计 ...

  4. Git学习总结(11)——Git撤销操作详解

    本文主要讨论和撤销有关的 git 操作.目的是让读者在遇到关于撤销问题时能够方便迅速对照执行解决问题,而不用去翻阅参数繁多的 git 使用说明. 一开始你只需了解大致功能即可,不必记住所有命令和具体参 ...

  5. NYIST 119 士兵杀敌(三)

    士兵杀敌(三)时间限制:2000 ms | 内存限制:65535 KB难度:5 描述南将军统率着N个士兵,士兵分别编号为1~N,南将军经常爱拿某一段编号内杀敌数最高的人与杀敌数最低的人进行比较,计算出 ...

  6. MSMQ如何设置事务特性

  7. eclipse转Android studio遇到的那些坑

           公司项目有导入10多个libray,还有涉及ndk,转Android studio时碰到不少问题.前后大概花费5个工作日,中间各种奇葩bug,各种编译出错,非常多还有没错误提示.一度想过 ...

  8. SSD纠错码向LDPC码演变

    作者:Stephen Bates SSD控制器芯片中採用的纠错编码(ECCs)的类型正在发生一场演变.相信很多这篇博文的读者对此都有所了解.传统上採用的纠错码是基于群变换的博斯-查德胡里-霍昆格母(B ...

  9. 堆排序(Swift版本)

    一:什么是堆? 堆可视为  "以数组方式存储的一棵完全二叉树" 堆又分为最大堆和最小堆, 最大堆就是对于整个二叉树中的每一个节点都满足:节点的键值比其左右子节点的键值都要大,对应的 ...

  10. webview同步cookies

    目前很多android app都内置了可以显示web页面的界面,会发现这个界面一般都是由一个叫做WebView的组件渲染出来的,学习该组件可以为你的app开发提升扩展性. 先说下WebView的一些优 ...