Cannot find the declaration of element 'ehcache'

xsi:noNamespaceSchemaLocation="ehcache.xsd"

this location must be a absolute path

like this: ...Location="classpath:/yourPathInProject/ehcache.xml"

before this ,you need to download the ehcache.xml from http://www.ehcache.org/ehcache.xsd and put it in your path .


In case of ehcache 3.x you may refer following template for ehcache.xml:

    <config
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns='http://www.ehcache.org/v3'
    xsi:schemaLocation="
        http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd">

  <cache alias="ready-cache">
    <key-type>java.lang.Long</key-type>
    <value-type>com.pany.domain.Product</value-type>
    <loader-writer>
      <class>com.pany.ehcache.integration.ProductCacheLoaderWriter</class>
    </loader-writer>
    <heap unit="entries">100</heap>
  </cache>

</config>

Basically the reference to ehcache's xsd is updated as per the above xsd declaration. For further details on how to use different XML options for ehcache 3.x , please refer ehcache documentation for JSR