2017-05-22 3 views
0

JPA 2.0用にEhcacheを設定しようとしています。 最初の私は、私は私のクラスパスにehcache.xmlを持ってpersistance.xmlJPA 2.0 L2キャッシュ投げ用のEhcache設定エラー

<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/> 
<property name="hibernate.cache.use_query_cache" value="true"/> 
<property name="hibernate.cache.use_second_level_cache" value="true"/> 
<property name="hibernate.generate_statistics" value="true"/> 

に次のセットアップを持っています。 @Cacheable(true)を私の@Entityクラスに設定してください。

以下のエラーが発生しています。

net.sf.ehcache.config.InvalidConfigurationException: There is one error in your configuration: 
    * Cache 'net.sf.ehcache.constructs.asynchronous.MessageCache' error: If your CacheManager has no maxBytesLocalHeap set, you need to either set maxEntriesLocalHeap or maxBytesLocalHeap at the Cache level 

ehcache.xml

<?xml version="1.0" encoding="UTF-8"?> 



<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" 
    monitoring="autodetect" dynamicConfig="true"> 

    <!-- By default, Ehcache stored the cached files in temp folder. --> 
    <!-- <diskStore path="java.io.tmpdir" /> --> 

    <!-- Ask Ehcache to store cache in this path --> 
    <diskStore path="c:\\cache" /> 

    <!-- Sample cache named cache1 
    This cache contains a maximum in memory of 10000 elements, and will expire 
    an element if it is idle for more than 5 minutes and lives for more than 
    10 minutes. 

    If there are more than 10000 elements it will overflow to the 
    disk cache, which in this configuration will go to wherever java.io.tmp is 
    defined on your system. On a standard Linux system this will be /tmp" --> 


     <Cache name = "com.test.myDataDE" 
     maxEntriesLocalHeap="10000" 
     maxEntriesLocalDisk="1000" 
     eternal="false" 
     diskSpoolBufferSizeMB="20" 
     timeToIdleSeconds="300" timeToLiveSeconds="600" 
     memoryStoreEvictionPolicy="LFU" 
     transactionalMode="off"> 
     <persistence strategy="localTempSwap" /> 
    </Cache> 

</ehcache> 

私は私がやっている任意のミスを理解して助けてください?

+0

あなたはehcache.xmlを共有して、何が欠落しているのか理解できるでしょうか?ありがとう –

+0

私のehcache.xmlを共有しました – user3461330

答えて

0

ehcache.xmlのコンテンツがないと、確定するのは難しいです。

ただし、エラーメッセージが表示された場合、エントリまたはバイト単位でキャッシュにヒープサイズを指定していないと考えられます。

maxBytesLocalHeap="100M" 

と削除を::

maxEntriesLocalHeap 

私のehcache.xml構成で今日は同じ問題を抱えていた

0

は、追加することで解決しました。

関連する問題