Hibernate NoCacheRegionFactoryAvailableException

后端 未结 5 2109
自闭症患者
自闭症患者 2021-02-20 04:24

I\'m getting a bizarre Hibernate exception that I can\'t explain. It\'s telling me that I\'m using 2nd level cache, but no where in hibernate.cfg.xml do I specify a

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-20 05:21

    This error is very misleading, I spent almost a day to finally figure out the root cause. Thought my hibernate config file has defined second level cache and factory class, it was giving me error that hibernate.cache.region.factory_class is not given.

    I see that by hibernate.cfg.xml file is also available in classpath. But even after any change in that there was no impact and getting same error.

    Finally I realized that for test purpose I have overridden persistence.xml file which has below missing properties under persistence-unit. After adding that issue was resolved.

     
                
    
    

    So this means my application was not able to find hibernate.cfg.xml file and somehow instead of giving error related to missing configuration, it cries out for factory class.

提交回复
热议问题