2017-05-05 15 views
1

イムこのエラーを取得しては:Hibernate設定 - NoCacheRegionFactoryAvailableException

<property name="hibernate.cache.use_query_cache">true</property> 
<property name="hibernate.cache.use_second_level_cache">true</property> 
<property name="hibernate.cache.provider_class">net.sf.hibernate.cache.EhCacheProvider</property> 
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</property> 

イムすると、休止状態4.3.10.Finalを使用し、私はすべての依存関係を持っている:

Caused by: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given; please either disable second level cache or set correct region factory using the hibernate.cache.region.factory_class setting and make sure the second level cache provider (hibernate-infinispan, e.g.) is available on the classpath. 

しかし、私は、そのプロパティが設定されています。

答えて

0

例外ブレークポイントをNoCacheRegionFactoryAvailableExceptionに置き、何が欠落しているかを確認してください。このエラーはベルを鳴らしますが、私は正確な原因を覚えていません。しかし、それは私がそれをデバッグした方法です。

Ehcache 3を使用していますか?現在のプロバイダはEhcache 2のためです。

0

私はSpringBootとHibernateで同じエラーが発生しました。バージョンに問題がありました。このlinkが私を助けました。

私はSpring Boot 1.5.1Hibernate 5.2.8を使用して修正hibernate.propertiesは、以下のようにファイル:

hibernate.cache.use_second_level_cache=true 
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory 

をエンティティにキャッシュ注釈を追加します。

@Entity 
@Table(name="test") 
@Cacheable 
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
public class Test{ 
} 
+0

このリンクは質問に答えるかもしれないが、それはに優れていますその答えの本質的な部分を含め、参考のためのリンクを提供してください。リンクされたページが変更された場合、リンクのみの回答は無効になります。 - [レビューより](/レビュー/低品質投稿/ 17983345) – EJoshuaS

+0

ありがとう@EJoshuaS、私は答えを変更しました。 –

関連する問題