title: Ehcache and SLF4J error
body: <p>I am new to Ehcache and Slf4j .I am using ehcache-2.6.6</p>
  <p>I have used</p>
  <p><strong>slf4j-api-1.6.1 jar</strong></p>
  <p><strong>slf4j-jdk14-1.6.1 jar</strong></p>
  <p>When i extracted ehcache-2.6.6-distribution.tar these two jars were in folder lib .</p>
  <p>This is my ehcache.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ehcache xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:noNamespaceSchemaLocation=&quot;ehcache.xsd&quot;
           updateCheck=&quot;true&quot; monitoring=&quot;autodetect&quot;
           dynamicConfig=&quot;true&quot;&gt;
  
  
      &lt;diskStore path=&quot;java.io.tmpdir&quot;/&gt;
  
      &lt;defaultCache
              maxEntriesLocalHeap=&quot;10000&quot;
              eternal=&quot;false&quot;
              timeToIdleSeconds=&quot;120&quot;
              timeToLiveSeconds=&quot;120&quot;
              diskSpoolBufferSizeMB=&quot;30&quot;
              maxEntriesLocalDisk=&quot;10000000&quot;
              diskExpiryThreadIntervalSeconds=&quot;120&quot;
              memoryStoreEvictionPolicy=&quot;LRU&quot;
              statistics=&quot;false&quot;&gt;
          &lt;persistence strategy=&quot;localTempSwap&quot;/&gt;
      &lt;/defaultCache&gt;
  
      &lt;cache name=&quot;myCache1&quot;
             maxEntriesLocalHeap=&quot;10000&quot;
             maxEntriesLocalDisk=&quot;1000&quot;
             eternal=&quot;false&quot;
             diskSpoolBufferSizeMB=&quot;20&quot;
             timeToIdleSeconds=&quot;300&quot;
             timeToLiveSeconds=&quot;600&quot;
             memoryStoreEvictionPolicy=&quot;LFU&quot;
             transactionalMode=&quot;off&quot;&gt;
          &lt;persistence strategy=&quot;localTempSwap&quot;/&gt;
      &lt;/cache&gt;
      
  &lt;/ehcache&gt;
  </code></pre>
  <p>This is my code</p>
  <pre><code>package cache;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import net.sf.ehcache.CacheManager;
  import net.sf.ehcache.Ehcache;
  import net.sf.ehcache.Element;
  
  public class EhcacheWrapper {
      private static CacheManager cacheManager;
      private static final String CACHE_NAME = &quot;myCache1&quot;;
  
     
  
     
  
     
      private static Ehcache getCache(String cacheName) {
          if (cacheManager == null) {
              cacheManager = CacheManager.create(&quot;ehcache.xml&quot;);
          }
  
          Ehcache cache = null;
          if (cacheManager != null) {
             
              cache = cacheManager.getEhcache(cacheName);
          }
  
          return cache;
      }
   
      public static &lt;T&gt; List&lt;T&gt; getListFromCache( String cacheName, String key, CacheCreation&lt;T&gt; cacheCreation){
          List&lt;T&gt; all = new ArrayList&lt;T&gt;();
              
          Ehcache cache = getCache(cacheName);
          Element element = null;
          if(cache!=null){
              element = cache.get(key);
          }
              
          if(element==null){
              System.out.println(&quot; : CacheUtil.getListFromCache() : the element '&quot;+key+&quot;' has not been found in the cache ---&gt; get the original data.&quot;);
  
              all = cacheCreation.getAll();
              cache.put(new Element(key, all));
              System.out.println(&quot; : CacheUtil.getListFromCache() : the original data for the element '&quot;+key+&quot;' has been added in the cache.&quot;);
  
  
          }else{
              System.out.println(&quot; : CacheUtil.getListFromCache() : the element '&quot;+key+&quot;' has been found in the cache.&quot;);
  
            
              all = (List&lt;T&gt;) element.getObjectValue();
          }
          return all;
  
      }
      public List&lt;String&gt; getAllData1(){
          return getListFromCache( CACHE_NAME, &quot;data1&quot;, new CacheCreation&lt;String&gt;(){
              @Override
              public List&lt;String&gt; getAll(){
                  System.out.println(&quot; : UseCaseClass.getAllData1() : the target original method is called to get the values.&quot;);
                  List&lt;String&gt; list = new ArrayList&lt;String&gt;();
                  list.add(&quot;data1-value1&quot;);
                  list.add(&quot;data1-value2&quot;);
                  list.add(&quot;data1-value3&quot;);
                  list.add(&quot;data1-value4&quot;);
                  return list;
              }
          });
      }
  
      
  
      public static void main(String[] args) {
          EhcacheWrapper wrappertest=new EhcacheWrapper();
          wrappertest.getAllData1();
          try {
              Thread.sleep(1500);
          } catch (InterruptedException e) {
             
             
          }
          wrappertest.getAllData1();
          try {
              Thread.sleep(1500);
          } catch (InterruptedException e) {
            
          }
          wrappertest.getAllData1();
          try {
              Thread.sleep(1500);
          } catch (InterruptedException e) {
             
          }
          
  
       
  
      }
  }
  </code></pre>
  <p>When i run program i am getting following output</p>
  <pre><code>SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
  SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
  May 15, 2013 1:52:36 PM net.sf.ehcache.DiskStorePathManager resolveAndLockIfNeeded
  WARNING: diskStorePath 'C:\Users\toshiba\AppData\Local\Temp' is already used by an existing CacheManager either in the same VM or in a different process.
  The diskStore path for this CacheManager will be set to C:\Users\toshiba\AppData\Local\Temp\ehcache_auto_created3199473242323720768diskstore.
  To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.
   : CacheUtil.getListFromCache() : the element 'data1' has not been found in the cache ---&gt; get the original data.
   : UseCaseClass.getAllData1() : the target original method is called to get the values.
   : CacheUtil.getListFromCache() : the original data for the element 'data1' has been added in the cache.
   : CacheUtil.getListFromCache() : the element 'data1' has been found in the cache.
   : CacheUtil.getListFromCache() : the element 'data1' has been found in the cache.
  </code></pre>
  <p><strong>Though i am getting expected output but there is error in beginning saying :</strong></p>
  <pre><code>SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
  SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
  May 15, 2013 1:52:36 PM net.sf.ehcache.DiskStorePathManager resolveAndLockIfNeeded
  WARNING: diskStorePath 'C:\Users\toshiba\AppData\Local\Temp' is already used by an existing CacheManager either in the same VM or in a different process.
  The diskStore path for this CacheManager will be set to C:\Users\toshiba\AppData\Local\Temp\ehcache_auto_created3199473242323720768diskstore.
  To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.
  </code></pre>
  <p>I look in
  <a href="http://www.slf4j.org/codes.html#version_mismatch" rel="nofollow noreferrer">slf4j-api version does not match that of the binding</a>
  for error but i could not get error for this</p>
  <p>I saw similar error here <a href="https://stackoverflow.com/questions/14017961/ehcache-simple-program-not-working">EhCache: Simple Program not working</a>
  But it is taking about distributed cache.
  For code i took reference from
  <a href="http://www.javablog.fr/javaehcache-a-simple-example-of-use-of-ehcache-2-6-2.html" rel="nofollow noreferrer">Java/Ehcache: A simple example of use of Ehcache 2.6.2</a></p>
  <p>Any help please why i am getting error in beginning?</p>