xsi:noNamespaceSchemaLocation使用心得
2017-10-10 11:03
239 查看
在使用ehcache的时候碰到一个问题:
Java代码
is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ehc
ache'
Java代码
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ehcache'
分析下来就是 ehcache.xml文件加载出问题了,根据错误可以看出是"ehcache"节点无法解析,那么首先就可以想到是描述文件出错ehcache.xsd;
为什么加载不到呢在本地直接
Java代码
curl -X GET http://ehcache.org/ehcache.xsd
发现确实是链接不到服务器,发现是内网机器无法访问网络;
定位到问题首先想到的就是,那把ehcache.xsd下载到本地直接读,思路是正确的,只是文件路径的设置需要注意一下
比如:
如果,ehcache.xsd 和 ehcache.xml文件同目录下面
Java代码
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="false" dynamicConfig="false">
这样配置是错误的,加载不了的;
那么要如何配置
Java代码
xsi:noNamespaceSchemaLocation=""
?
看了一下源代码
Java代码
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(InputSource inputSource, Resource resource)
Resource:我首先想到的就是:classpath:META-INF/spring/ehcache.xsd
没有仔细看,直接改上去:
Java代码
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="classpath:META-INF/spring/ehcache.xsd"
updateCheck="false" dynamicConfig="false">
Java代码
is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ehc
ache'
Java代码
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ehcache'
分析下来就是 ehcache.xml文件加载出问题了,根据错误可以看出是"ehcache"节点无法解析,那么首先就可以想到是描述文件出错ehcache.xsd;
为什么加载不到呢在本地直接
Java代码
curl -X GET http://ehcache.org/ehcache.xsd
发现确实是链接不到服务器,发现是内网机器无法访问网络;
定位到问题首先想到的就是,那把ehcache.xsd下载到本地直接读,思路是正确的,只是文件路径的设置需要注意一下
比如:
如果,ehcache.xsd 和 ehcache.xml文件同目录下面
Java代码
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="false" dynamicConfig="false">
这样配置是错误的,加载不了的;
那么要如何配置
Java代码
xsi:noNamespaceSchemaLocation=""
?
看了一下源代码
Java代码
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(InputSource inputSource, Resource resource)
Resource:我首先想到的就是:classpath:META-INF/spring/ehcache.xsd
没有仔细看,直接改上去:
Java代码
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="classpath:META-INF/spring/ehcache.xsd"
updateCheck="false" dynamicConfig="false">
相关文章推荐
- Jaxb解析xml(带命名空间)相关联的属性 "xsi:NamespaceSchemaLocation" 的前缀 "xsi" 未绑定。
- xml 添加xsi:schemaLocation 属性
- XML——xmlns、xmlns:xsi和xsi:schemaLocation
- ActiveReport使用心得(五):"No Report Specified"错误的可能原因(轉)
- xsi:schemaLocation有何作用
- XML文档的xmlns、xmlns xsi和xsi schemaLocation
- 关于XML文档的xmlns、xmlns:xsi和xsi:schemaLocation
- 在使用了Maven后出现了There is no Action mapped for namespace [/] and action name [*] associated with context
- 关于XML文档的xmlns、xmlns:xsi和xsi:schemaLocation
- 关于XML文档的xmlns、xmlns:xsi和xsi:schemaLocation
- Ubuntu16.4 LTS 使用 pip报错'_NamespacePath' object has no attribute 'sort'的解决方法
- xsi:schemaLocation属性
- myeclipse中配置xsi:schemaLocation路径,实现xml文件自动提示
- 使用SSH时there is no action mapped for namespace[/]错误的解决方案
- xsi:schemaLocation详解
- XML文档中的xmlns、xmlns:xsi和xsi:schemaLocation
- xsi:schemaLocation详解
- ActiveReport使用心得(五):"No Report Specified"错误的可能原因
- eclipse中配置Spring的xsi:schemaLocation
- 每当使用struts2动态方法调用时,总是出现错误:There is no Action mapped for namespace [/user] and action name [user!add]