Cvc-elt.1:cannot find the declaration of element ' Ehcache '.

Source: Internet
Author: User



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 '.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.