NutzCN Logo
问答 Linux Tomcat 没有权限创建缓存文件 及路径 怎么解决呢
发布于 1948天前 作者 Hamming 3420 次浏览 复制 上一个帖子 下一个帖子
标签:

Linux Tomcat 没有权限创建缓存文件 及路径 怎么解决呢
为了图省事 在 Ubuntu 直接命令安装 Tomcat
apt-get install tomcat8
它的配置文件在/etc/tomcat8下,启动文件在/usr/share/tomcat8下
不知道该在哪里加权限 让项目能启动 创建缓存目录 文件

[ERROR] 2018-11-27 14:44:17,132 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:146) - Shiro environment initialization failed
org.apache.shiro.config.ConfigurationException: Unable to set property 'cacheManager' with value [org.apache.shiro.cache.ehcache.EhCacheManager@1ed6d6da] on object of type org.apache.shiro.web.mgt.DefaultWebSecurityManager.  If 'org.apache.shiro.cache.ehcache.EhCacheManager@1ed6d6da' is a reference to another (previously defined) object, prefix it with '$' to indicate that the referenced object should be used as the actual value.  For example, $org.apache.shiro.cache.ehcache.EhCacheManager@1ed6d6da
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:501)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:450)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:562)
	at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:206)
	at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:167)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:124)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:161)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:124)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:102)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:88)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at org.apache.shiro.web.env.IniWebEnvironment.createWebSecurityManager(IniWebEnvironment.java:203)
	at org.apache.shiro.web.env.IniWebEnvironment.configure(IniWebEnvironment.java:99)
	at org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:92)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
	at org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
	at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
	at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4821)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5264)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
	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.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2170)
	at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151)
	at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957)
	at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064)
	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456)
	at org.apache.shiro.config.ReflectionBuilder.setProperty(ReflectionBuilder.java:493)
	... 33 more
Caused by: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: java.io.IOException: Permission denied
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:224)
	at org.apache.shiro.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:156)
	at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:245)
	at org.apache.shiro.realm.AuthorizingRealm.getAvailableAuthorizationCache(AuthorizingRealm.java:260)
	at org.apache.shiro.realm.AuthorizingRealm.afterCacheManagerSet(AuthorizingRealm.java:226)
	at org.apache.shiro.realm.CachingRealm.setCacheManager(CachingRealm.java:96)
	at org.apache.shiro.mgt.RealmSecurityManager.applyCacheManagerToRealms(RealmSecurityManager.java:115)
	at org.apache.shiro.mgt.RealmSecurityManager.afterCacheManagerSet(RealmSecurityManager.java:127)
	at org.apache.shiro.mgt.SessionsSecurityManager.afterCacheManagerSet(SessionsSecurityManager.java:103)
	at org.apache.shiro.mgt.CachingSecurityManager.setCacheManager(CachingSecurityManager.java:72)
	... 44 more
Caused by: net.sf.ehcache.CacheException: java.io.IOException: Permission denied
	at net.sf.ehcache.DiskStorePathManager$DiskStorePath.<init>(DiskStorePathManager.java:331)
	at net.sf.ehcache.DiskStorePathManager.resolveAndLockIfNeeded(DiskStorePathManager.java:145)
	at net.sf.ehcache.DiskStorePathManager.getFile(DiskStorePathManager.java:262)
	at net.sf.ehcache.DiskStorePathManager.getFile(DiskStorePathManager.java:251)
	at net.sf.ehcache.store.disk.DiskStorageFactory.<init>(DiskStorageFactory.java:127)
	at net.sf.ehcache.store.disk.DiskStore.create(DiskStore.java:154)
	at net.sf.ehcache.store.disk.DiskStore.createCacheStore(DiskStore.java:182)
	at net.sf.ehcache.Cache.initialise(Cache.java:1216)
	at net.sf.ehcache.CacheManager.initializeEhcache(CacheManager.java:1357)
	at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1423)
	at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:819)
	at net.sf.ehcache.CacheManager.doInit(CacheManager.java:498)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:394)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:355)
	at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:213)
	... 53 more
Caused by: java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:1012)
	at net.sf.ehcache.DiskStorePathManager$DiskStorePath.<init>(DiskStorePathManager.java:322)
	... 67 more
6 回复

检查ehcache.xml里面的路径

我设置成/

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false"
    monitoring="autodetect" dynamicConfig="true" name="nutzwk">
    <diskStore path="/"/>
    <cache name="shiro-activeSessionCache"
           maxElementsInMemory="1000"
           overflowToDisk="true"
           eternal="true"
           timeToLiveSeconds="0"
           timeToIdleSeconds="0"
           diskPersistent="true"
           diskExpiryThreadIntervalSeconds="600"/>

    <defaultCache maxElementsInMemory="10000" eternal="false"
                  timeToIdleSeconds="86400" timeToLiveSeconds="86400" overflowToDisk="false"
                  diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
                  statistics="false" />

    <cache name="codeCache" maxElementsInMemory="0" eternal="false" overflowToDisk="true" timeToIdleSeconds="0"
           timeToLiveSeconds="300"/>
</ehcache>

你以为那是webapp的根目录?那是系统路径,跟webapp没关系

设置成空也不行

 <diskStore path=""/>

。。。 就不能选个正常点是路径吗?

例如 /data/cache

添加回复
请先登陆
回到顶部