javahibernate

Hibernate 5 Unable to create requested service [org.hibernate.cache.spi.CacheImplementor]


I am migrating application to Hibernate 5 and I am getting an error:

ERROR repository.legacy.HibernateSessionManager - "Initial SessionFactory creation failed"
org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.CacheImplementor]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
Caused by: net.sf.ehcache.CacheException: java.io.IOException: Access is denied
    at net.sf.ehcache.DiskStorePathManager$DiskStorePath.<init>(DiskStorePathManager.java:331)
Caused by: java.io.IOException: Access is denied
    at java.io.WinNTFileSystem.createFileExclusively(Native Method)

I am using hibernate

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.6.1.Final</version>
</dependency>

with:

<dependency>
    <groupId>org.ehcache</groupId>
    <artifactId>ehcache</artifactId>
    <version>3.4.0</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-ehcache</artifactId>
    <version>5.6.1.Final</version>
</dependency>

in hibernate.cfg.xml I have:

<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</property>
<property name="cache.use_query_cache">true</property>

I found similar questions but noone got this: Caused by: net.sf.ehcache.CacheException: java.io.IOException: Access is denied

What is the problem here?


Solution

  • Thanks @Joan for help. Problem was that in Tomcat configuration enter image description here

    I put path which was not accessible by application. After change to other path file was created and I don't see Access denied error