警告:在Hibernate中找不到名为Cache的消息的特定ehcache配置

时间:2019-08-15 02:23:49

标签: hibernate caching ehcache hibernate-5.x ehcache-2

在服务器Jboss eap 7.1中部署应用程序时获取警告消息-在启动服务器下方时,消息在Eclipse控制台日志中显示,如下所示,

 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.org.hibernate.cache.spi.UpdateTimestampsCache]; using defaults.
 INFO  [org.hibernate.cache.internal.StandardQueryCache] (ServerService Thread Pool -- 63) HHH000248: Starting query cache at region: SReporting.war#sReportingDS.org.hibernate.cache.internal.StandardQueryCache
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.org.hibernate.cache.internal.StandardQueryCache]; using defaults.
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.com.webaccess.hibernate.Mimetype]; using defaults.
 WARN  [org.hibernate.cache.ehcache.internal.strategy.EhcacheAccessStrategyFactoryImpl] (ServerService Thread Pool -- 63) HHH020007: read-only cache configured for mutable entity [SReporting.war#sReportingDS.com.webaccess.hibernate.Mimetype]
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.com.webaccess.hibernate.Shortid]; using defaults.
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.com.webaccess.hibernate.CounterName]; using defaults.
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.com.webaccess.hibernate.CounterNameSummary]; using defaults.
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.com.webaccess.hibernate.CounterKey]; using defaults.
 WARN  [org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory] (ServerService Thread Pool -- 63) HHH020003: Could not find a specific ehcache configuration for cache named [SReporting.war#sReportingDS.com.webaccess.hibernate.CountryCode]; using defaults.
 INFO  [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool -- 63) HHH000397: Using ASTQueryTranslatorFactory

在POM.XML中,

<version.ehcache-core>2.4.3</version.ehcache-core>
<version.ehcache>2.10.3</version.ehcache>
<version.hibernate-ehcache>5.1.10.Final</version.hibernate-ehcache>
<version.hibernate-jpa>1.0.1.Final</version.hibernate-jpa>
<version.hibernate-core>5.3.7.Final</version.hibernate-core>
<version.hibernate-annotations>3.5.6-Final</version.hibernate-annotations>
<version.hibernate-validator>6.0.13.Final</version.hibernate-validator>
<version.hibernate-commons-annotations>5.0.4.Final</version.hibernate-commons-annotations>

还在persistence.xml文件中进行如下配置,

<property name="hibernate.cache.region.factory_class"
                value="org.hibernate.cache.ehcache.EhCacheRegionFactory" />
<property name="hibernate.generate_statistics" value="true"/>
<property name="hibernate.id.new_generator_mappings" value ="false"/>
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_query_cache" value="true" />
<property name="hibernate.default_batch_fetch_size" value="16" />
<property name="hibernate.generate_statistics" value="true" />
<property name="hibernate.cache.use_structured_entries"
                value="true" />
<property name="net.sf.ehcache.configurationResourceName"
                value="/ehcache.xml" />

配置文件eh_user_cache.xml如下

<ehcache xsi:noNamespaceSchemaLocation="ehcache.xsd"
    updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<diskStore path="${file.root}/eh_user_cache" />
<defaultCache maxElementsInMemory="10000" eternal="false"
        timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" />
<cache name="users" maxElementsInMemory="120000" eternal="false"
        timeToIdleSeconds="600" timeToLiveSeconds="14400" overflowToDisk="true"
        diskPersistent="false" memoryStoreEvictionPolicy="FIFO" />
</ehcache>

还如下配置ehcache.xml,

<ehcache xsi:noNamespaceSchemaLocation="ehcache.xsd"
    updateCheck="true" monitoring="autodetect" dynamicConfig="true">

    <diskStore path="${file.root}/cache" />

    <defaultCache maxElementsInMemory="10000" eternal="false"
        timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" />

    <cache
        name="persistence.unit:unitName=#SReporting.com.webaccess.hibernate.CounterKey"
        maxElementsInMemory="100000" eternal="false" overflowToDisk="false"
        timeToLiveSeconds="1200" timeToIdleSeconds="600" diskPersistent="false"
         memoryStoreEvictionPolicy="LRU" />

    <cache
        name="persistence.unit:unitName=#SReporting.com.webaccess.hibernate.CounterName"
        maxElementsInMemory="500000" overflowToDisk="false" timeToLiveSeconds="1200"
        timeToIdleSeconds="600" diskPersistent="false" 
        memoryStoreEvictionPolicy="LRU" />

    <cache
        name="persistence.unit:unitName=#SReporting.com.webaccess.hibernate.Shortid"
        maxElementsInMemory="500000" overflowToDisk="false" timeToLiveSeconds="1200"
        timeToIdleSeconds="600" diskPersistent="false" 
        memoryStoreEvictionPolicy="LRU" />

    <cache
        name="persistence.unit:unitName=#SReporting.com.webaccess.hibernate.CounterNameSummary"
        maxElementsInMemory="10000" eternal="false" timeToLiveSeconds="1200"
        timeToIdleSeconds="600" overflowToDisk="true" diskPersistent="false"
         memoryStoreEvictionPolicy="LRU" />

    <cache
        name="persistence.unit:unitName=#SReporting.com.webaccess.hibernate.CountryCode"
        maxElementsInMemory="100" eternal="true" overflowToDisk="false"
        diskPersistent="false"  />

    <cache
        name="persistence.unit:unitName=#SReporting.com.webaccess.hibernate.Mimetype"
        maxElementsInMemory="1000" eternal="true" overflowToDisk="false"
        diskPersistent="false"  />

    <cache
        name="persistence.unit:unitName=#SReporting.org.hibernate.cache.StandardQueryCache"
        maxElementsInMemory="10000" timeToLiveSeconds="1200"
        timeToIdleSeconds="30" overflowToDisk="true" diskPersistent="false"
         memoryStoreEvictionPolicy="LRU" />

    <cache
        name="persistence.unit:unitName=#SReporting.org.hibernate.cache.UpdateTimestampsCache"
        maxElementsInMemory="5000" timeToLiveSeconds="1200" overflowToDisk="true"
        diskPersistent="false" memoryStoreEvictionPolicy="LRU" />
</ehcache>

更多日志错误:


WARN  [org.jboss.seam.security.permission.PersistentPermissionResolver] no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.
WARN  [net.sf.ehcache.CacheManager] Creating a new instance of CacheManager using the diskStorePath "/data/jboss-eap7/SR/storage/cache" which is already used by an existing CacheManager.
The source of the configuration was net.sf.ehcache.config.generator.ConfigurationSource$URLConfigurationSource@22ca95d9.
The diskStore path for this CacheManager will be set to /data/jboss-eap7/SR/storage/cache/ehcache_auto_created_1565789688939.
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.
2019-08-14 15:34:48,939 WARN  [net.sf.ehcache.CacheManager] Creating a new instance of CacheManager using the diskStorePath "/data/jboss-eap7/SR/storage/cache" which is already used by an existing CacheManager.
The source of the configuration was net.sf.ehcache.config.generator.ConfigurationSource$URLConfigurationSource@22ca95d9.
The diskStore path for this CacheManager will be set to /data/jboss-eap7/SR/storage/cache/ehcache_auto_created_1565789688939.
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.

还正确配置了ehcache.xsd文件 我不想将“ org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory”日志级别设置为ERROR:

如何解决问题? 还想知道为什么会这样? 因为这个应用程序的性能会受到影响吗? 一些解决方案将有助于我轻松快速地解决问题。有助于您进一步了解该问题。谢谢。

0 个答案:

没有答案
相关问题