Could not create disk store. Initial cause was null

hibernate配置二级缓存的时候,报错


C:\Java\jdk1.8.0_151\bin\java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IDEA\lib\idea_rt.jar=1988:C:\Program Files\JetBrains\IDEA\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IDEA\lib\idea_rt.jar;C:\Program Files\JetBrains\IDEA\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IDEA\plugins\junit\lib\junit5-rt.jar;C:\Java\jdk1.8.0_151\jre\lib\charsets.jar;C:\Java\jdk1.8.0_151\jre\lib\deploy.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\access-bridge-64.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\cldrdata.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\dnsns.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\jaccess.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\jfxrt.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\localedata.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\nashorn.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\sunec.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\sunjce_provider.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\sunmscapi.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\sunpkcs11.jar;C:\Java\jdk1.8.0_151\jre\lib\ext\zipfs.jar;C:\Java\jdk1.8.0_151\jre\lib\javaws.jar;C:\Java\jdk1.8.0_151\jre\lib\jce.jar;C:\Java\jdk1.8.0_151\jre\lib\jfr.jar;C:\Java\jdk1.8.0_151\jre\lib\jfxswt.jar;C:\Java\jdk1.8.0_151\jre\lib\jsse.jar;C:\Java\jdk1.8.0_151\jre\lib\management-agent.jar;C:\Java\jdk1.8.0_151\jre\lib\plugin.jar;C:\Java\jdk1.8.0_151\jre\lib\resources.jar;C:\Java\jdk1.8.0_151\jre\lib\rt.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateTest06SecondLevelCache\out\production\HibernateLoadStrategy;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\jta-1.1.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\hibernate3.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\antlr-2.7.6.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\dom4j-1.6.1.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\slf4j-api-1.6.1.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\javassist-3.12.0.GA.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\commons-collections-3.1.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\mysql-connector-java-5.1.44-bin.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateBasicLib\hibernate-jpa-2.0-api-1.0.1.Final.jar;C:\Program Files\JetBrains\IDEA\lib\junit-4.12.jar;C:\Program Files\JetBrains\IDEA\lib\hamcrest-core-1.3.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateTest06SecondLevelCache\lib\ehcache-1.5.0.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateTest06SecondLevelCache\lib\commons-logging.jar;C:\Users\Jackson\Workspaces\IDEA\HibernateTest06SecondLevelCache\lib\backport-util-concurrent.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.cskaoyan.test.SecondLevelCacheTest,classCacheTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

java.lang.ExceptionInInitializerError
	at com.cskaoyan.test.SecondLevelCacheTest.classCacheTest(SecondLevelCacheTest.java:16)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: com.cskaoyan.bean.UserCache: Could not create disk store. Initial cause was null
	at org.hibernate.cache.EhCacheProvider.buildCache(EhCacheProvider.java:101)
	at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.buildEntityRegion(RegionFactoryCacheProviderBridge.java:104)
	at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:280)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
	at com.cskaoyan.utils.HbSessionUtil.(HbSessionUtil.java:12)
	... 23 more
Caused by: net.sf.ehcache.CacheException: com.cskaoyan.bean.UserCache: Could not create disk store. Initial cause was null
	at net.sf.ehcache.store.DiskStore.(DiskStore.java:164)
	at net.sf.ehcache.Cache.createDiskStore(Cache.java:577)
	at net.sf.ehcache.Cache.initialise(Cache.java:549)
	at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:707)
	at net.sf.ehcache.CacheManager.addCache(CacheManager.java:697)
	at net.sf.ehcache.CacheManager.addCache(CacheManager.java:634)
	at org.hibernate.cache.EhCacheProvider.buildCache(EhCacheProvider.java:94)
	... 27 more
Caused by: java.lang.NullPointerException
	at java.io.File.(File.java:277)
	at net.sf.ehcache.store.DiskStore.initialiseFiles(DiskStore.java:172)
	at net.sf.ehcache.store.DiskStore.(DiskStore.java:152)
	... 33 more


Process finished with exit code -1



修改配置文件:

Could not create disk store. Initial cause was null_第1张图片


你可能感兴趣的:(Java)