二级缓存抛出错误的JPA 2.0 Ehcache配置

二级缓存抛出错误的JPA 2.0 Ehcache配置,jpa,jpa-2.0,ehcache,persistence.xml,Jpa,Jpa 2.0,Ehcache,Persistence.xml,我正在尝试为JPA2.0配置Ehcache。 首先,我将以下内容设置为persistence.xml <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/> <property name="hibernate.cache.use_query_cache" value="true"/> <property na

我正在尝试为JPA2.0配置Ehcache。 首先,我将以下内容设置为
persistence.xml

<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"/>
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>


请帮助我理解我所犯的任何错误?

没有您的
ehcache.xml
内容,很难确定


但是,根据错误消息,我认为问题在于您没有以条目或字节为单位指定缓存的堆大小。

我今天也遇到了同样的问题,通过添加以下内容解决了此问题:

maxBytesLocalHeap="100M"
以及删除:

maxEntriesLocalHeap

在我的ehcache.xml配置中。

能否共享您的ehcache.xml,以便我们了解可能缺少的内容?谢谢分享我的ehcache.xml
maxEntriesLocalHeap