An exception occurred while configuring the cache in the Spring project:
Org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line 1 in XML document from file [D:\workspaces \eclipse_svn\newsportalproject\webcontent\web-inf\classes\config\ehcache.xml] is invalid; Nested exception is org.xml.sax.saxparseexception:cvc-elt.1:cannot find the declaration of element ' Ehcache '.
is caused by omitting the namespace statement in the configuration file ~
Original configuration file
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="10"
timeToLiveSeconds="10"
overflowToDisk="false"/>
<cache name="newslist"
eternal="false"
timeToIdleSeconds="360"
timeToLiveSeconds="3600"
maxElementsInMemory="100"
overflowToDisk="false"
diskPersistent="false"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
to add a configuration file after a namespace
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
updateCheck="false">
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="10"
timeToLiveSeconds="10"
overflowToDisk="false"/>
<cache name="newslist"
eternal="false"
timeToIdleSeconds="360"
timeToLiveSeconds="3600"
maxElementsInMemory="100"
overflowToDisk="false"
diskPersistent="false"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
Explain:
Xmlns:xsi= the meaning of xsi in "Http://www.w3.org/2001/XMLSchema-instance" is:
This XML file will use some elements from the namespace of "http://www.w3.org/2001/XMLSchema-instance" represented by XSI.
For example, the nonamespaceschemalocation= "XXX" is used to introduce the schema file without namespace;
And the schemalocation= "XXX" elements that introduce the schema file from the namespace.
These elements are contained in the XSI namespace, and all XML files will be introduced into the XSI namespace as long as they are referenced.
XSi These three letters are not mandatory, but everyone is so used, easy to read.
Cvc-elt.1:cannot find the declaration of element ' Ehcache '.