NutzCN Logo
问答 我只想用redis实现session共享,不想用shiro做验证登录,请问怎么配置
发布于 240天前 作者 quinnxiao 612 次浏览 复制 上一个帖子 下一个帖子
标签:

我只想用redis实现session共享,不想用shiro做验证登录,请问怎么配置

22 回复

之前是用的tomcat redis session manager,但是应用启动后报错了

HTTP Status 500 - Could not get a resource from the pool
type Exception report

message Could not get a resource from the pool

description The server encountered an internal error that prevented it from fulfilling this request.

exception

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	redis.clients.util.Pool.getResource(Pool.java:50)
	redis.clients.jedis.JedisPool.getResource(JedisPool.java:86)
	com.radiadesign.catalina.session.RedisSessionManager.acquireConnection(RedisSessionManager.java:111)
	com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:391)
	com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:325)
	org.apache.catalina.connector.Request.doGetSession(Request.java:3048)
	org.apache.catalina.connector.Request.getSessionInternal(Request.java:2662)
	com.radiadesign.catalina.session.RedisSessionHandlerValve.invoke(RedisSessionHandlerValve.java:28)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:748)
root cause

redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: 拒绝连接 (Connection refused)
	redis.clients.jedis.Connection.connect(Connection.java:155)
	redis.clients.jedis.BinaryClient.connect(BinaryClient.java:83)
	redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1643)
	redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:85)
	org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:861)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
	redis.clients.util.Pool.getResource(Pool.java:48)
	redis.clients.jedis.JedisPool.getResource(JedisPool.java:86)
	com.radiadesign.catalina.session.RedisSessionManager.acquireConnection(RedisSessionManager.java:111)
	com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:391)
	com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:325)
	org.apache.catalina.connector.Request.doGetSession(Request.java:3048)
	org.apache.catalina.connector.Request.getSessionInternal(Request.java:2662)
	com.radiadesign.catalina.session.RedisSessionHandlerValve.invoke(RedisSessionHandlerValve.java:28)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:748)
root cause

java.net.ConnectException: 拒绝连接 (Connection refused)
	java.net.PlainSocketImpl.socketConnect(Native Method)
	java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	java.net.Socket.connect(Socket.java:589)
	redis.clients.jedis.Connection.connect(Connection.java:149)
	redis.clients.jedis.BinaryClient.connect(BinaryClient.java:83)
	redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1643)
	redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:85)
	org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:861)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
	redis.clients.util.Pool.getResource(Pool.java:48)
	redis.clients.jedis.JedisPool.getResource(JedisPool.java:86)
	com.radiadesign.catalina.session.RedisSessionManager.acquireConnection(RedisSessionManager.java:111)
	com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:391)
	com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:325)
	org.apache.catalina.connector.Request.doGetSession(Request.java:3048)
	org.apache.catalina.connector.Request.getSessionInternal(Request.java:2662)
	com.radiadesign.catalina.session.RedisSessionHandlerValve.invoke(RedisSessionHandlerValve.java:28)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:748)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.82 logs.

Apache Tomcat/7.0.82

redis没启动或者连接参数不对

我的项目中还没用redis,包也没放,只是把打好的三个jar包放到tomcat的lib里面,启动tomcat默认工程没问题,但是把现在的项目放进去就报这个错了

redis没启动或者连接参数不对

应该知道redis是个独立程序,需要额外启动吧

我是用nginx+tomcat做分布式,配置成功了,也是可以启动的实现了session共享。但是把现在项目放进去启动tomcat后访问就这样呢。我现在项目中不用redis

怎样验证session共享是成功的??

报错信息提示的就是连不上redis, 要么没redis启动要么配错redis连接参数, 这跟nginx等东西有毛线关系??

redis现在连上了,打开网页打印sessionID是一致的,但是登录后没用又回到了登录页面

所以共享session根本没配好嘛

不用redis + tomcat 用shiro的二级缓存实现session共享怎么配置,我不用shiro做登录的权限验证

不配realm和urls

按照文档配置启动后报错了

DXJ50: 2018-04-17 09:08:34,542 [RMI TCP Connection(3)-127.0.0.1] DEBUG org.apache.shiro.io.ResourceUtils - Opening resource from class path [shiro.ini]
DXJ50: 2018-04-17 09:08:34,546 [RMI TCP Connection(3)-127.0.0.1] DEBUG org.apache.shiro.config.Ini - Parsing [main]
DXJ50: 2018-04-17 09:08:34,550 [RMI TCP Connection(3)-127.0.0.1] DEBUG org.apache.shiro.config.Ini - Parsing [urls]
DXJ50: 2018-04-17 09:08:34,550 [RMI TCP Connection(3)-127.0.0.1] DEBUG org.apache.shiro.web.env.IniWebEnvironment - Discovered non-empty INI configuration at location 'classpath:shiro.ini'.  Using for configuration.
DXJ50: 2018-04-17 09:08:34,553 [RMI TCP Connection(3)-127.0.0.1] DEBUG org.apache.shiro.config.IniFactorySupport - Creating instance from Ini [sections=main,urls]
DXJ50: 2018-04-17 09:08:34,780 [RMI TCP Connection(3)-127.0.0.1] ERROR org.apache.shiro.web.env.EnvironmentLoader - Shiro environment initialization failed
java.lang.NoClassDefFoundError: redis/clients/jedis/Jedis
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
	at java.lang.Class.getConstructor0(Class.java:3075)
	at java.lang.Class.newInstance(Class.java:412)
	at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:181)
	at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:168)
	at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:302)
	at org.apache.shiro.config.ReflectionBuilder$InstantiationStatement.doExecute(ReflectionBuilder.java:927)
	at org.apache.shiro.config.ReflectionBuilder$Statement.execute(ReflectionBuilder.java:887)
	at org.apache.shiro.config.ReflectionBuilder$BeanConfigurationProcessor.execute(ReflectionBuilder.java:765)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:260)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:167)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:130)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:108)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:94)
	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:4973)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1740)
	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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
	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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	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.ClassNotFoundException: redis.clients.jedis.Jedis
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
	... 71 more
ClassLoaderLeakPreventorListener: Settings for se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventorListener (CL: 0x18370ca):
ClassLoaderLeakPreventorListener:   stopThreads = true
ClassLoaderLeakPreventorListener:   stopTimerThreads = true
ClassLoaderLeakPreventorListener:   executeShutdownHooks = true
ClassLoaderLeakPreventorListener:   threadWaitMs = 5000 ms
ClassLoaderLeakPreventorListener:   shutdownHookWaitMs = 10000 ms

shiro.ini的配置

[main]

;-------------Redis作为shiro二级缓存时启用这里---------
jedisAgent = org.nutz.integration.jedis.JedisAgent
cacheManager_ehcache = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager_ehcache.cacheManagerConfigFile=classpath:ehcache.xml
cacheManager_redis = org.nutz.plugins.cache.impl.redis.RedisCacheManager
cacheManager_redis.mode=kv
cacheManager_redis.debug=true
cacheManager = org.nutz.plugins.cache.impl.lcache.LCacheManager
cacheManager.jedisAgent = $jedisAgent
cacheManager.level1 = $cacheManager_ehcache
cacheManager.level2 = $cacheManager_redis
;-------------Redis作为shiro二级缓存时启用这里---------

# Session
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionValidationSchedulerEnabled = false

# Session Cache
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionDAO.cacheManager = $cacheManager
sessionDAO.activeSessionsCacheName = shiro-activeSessionCache
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager

# Cookie
sessionIdCookie = org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name = sid
#sessionIdCookie.domain=wizzer.cn
#sessionIdCookie.path=
sessionIdCookie.maxAge = 946080000
sessionIdCookie.httpOnly = true
sessionManager.sessionIdCookie = $sessionIdCookie
sessionManager.sessionIdCookieEnabled = true
sessionManager.globalSessionTimeout = 3600000

#bak...
#sessionManager=org.apache.shiro.web.session.mgt.DefaultWebSessionManager
#sessionListener1 = cn.wizzer.common.shiro.listener.MySessionListener
#sessionManager.sessionListeners = $sessionListener1
#sessionManager.globalSessionTimeout=50000
#securityManager.sessionManager=$sessionManager

rememberMeCookie = org.apache.shiro.web.servlet.SimpleCookie
rememberMeCookie.name = remember
rememberMeCookie.maxAge = 604800
rememberMeCookie.httpOnly = true
rememberMeManager = org.apache.shiro.web.mgt.CookieRememberMeManager
rememberMeManager.cookie = $rememberMeCookie

sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
sha256Matcher.storedCredentialsHexEncoded = false
sha256Matcher.hashIterations = 1024
sha256Matcher.hashSalted = true

[urls]
/* = anon

导入的maven包

<!--redis配置-->
    <dependency>
      <groupId>redis.clients</groupId>
      <artifactId>jedis</artifactId>
      <version>2.9.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz-integration-jedis</artifactId>
      <version>1.r.66-SNAPSHOT</version>
    </dependency>

redis.properties

redis.host=192.168.84.129
redis.port=6379
redis.timeout=2000
redis.password=root
#redis集群模式设置 redis.mode=cluster
redis.mode=normal

我已经导入了这个包了,再代码中也可以点出来呢。怎么还是提示找不到这个类

删掉

<scope>provided</scope>

删掉了,但是又出现新的错误了

DXJ50: 2018-04-17 12:25:22,687 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.DiskStorePathManager - Using diskstore path ehcache.disk.store.dir\clouds
DXJ50: 2018-04-17 12:25:22,688 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.DiskStorePathManager - Holding exclusive lock on D:\apache-tomcat-7.0.53\bin\ehcache.disk.store.dir\clouds\.ehcache-diskstore.lock
DXJ50: 2018-04-17 12:25:22,694 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.store.disk.DiskStorageFactory - Matching data file missing (or empty) for index file. Deleting index file ehcache.disk.store.dir\clouds\shiro-active%0053ession%0043ache.index
DXJ50: 2018-04-17 12:25:22,695 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.store.disk.DiskStorageFactory - Failed to delete file shiro-active%0053ession%0043ache.index
DXJ50: 2018-04-17 12:25:22,746 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LOCAL_OFFHEAP_SIZE
DXJ50: 2018-04-17 12:25:22,747 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LOCAL_OFFHEAP_SIZE_BYTES
DXJ50: 2018-04-17 12:25:22,748 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: WRITER_QUEUE_LENGTH
DXJ50: 2018-04-17 12:25:22,748 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: REMOTE_SIZE
DXJ50: 2018-04-17 12:25:22,748 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LAST_REJOIN_TIMESTAMP
DXJ50: 2018-04-17 12:25:22,759 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: OFFHEAP_GET
DXJ50: 2018-04-17 12:25:22,760 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: OFFHEAP_PUT
DXJ50: 2018-04-17 12:25:22,760 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: OFFHEAP_REMOVE
DXJ50: 2018-04-17 12:25:22,761 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: XA_COMMIT
DXJ50: 2018-04-17 12:25:22,761 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: XA_ROLLBACK
DXJ50: 2018-04-17 12:25:22,762 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: XA_RECOVERY
DXJ50: 2018-04-17 12:25:22,762 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: CLUSTER_EVENT
DXJ50: 2018-04-17 12:25:22,762 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: NONSTOP
DXJ50: 2018-04-17 12:25:22,767 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.Cache - Initialised cache: shiro-activeSessionCache
DXJ50: 2018-04-17 12:25:22,768 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.config.ConfigurationHelper - CacheDecoratorFactory not configured. Skipping for 'shiro-activeSessionCache'.
DXJ50: 2018-04-17 12:25:22,768 [RMI TCP Connection(3)-127.0.0.1] DEBUG net.sf.ehcache.config.ConfigurationHelper - CacheDecoratorFactory not configured for defaultCache. Skipping for 'shiro-activeSessionCache'.
DXJ50: 2018-04-17 12:25:22,769 [RMI TCP Connection(3)-127.0.0.1] DEBUG org.apache.shiro.cache.ehcache.EhCacheManager - implicit cacheManager created successfully.
DXJ50: 2018-04-17 12:25:22,771 [RMI TCP Connection(3)-127.0.0.1] ERROR org.apache.shiro.web.env.EnvironmentLoader - Shiro environment initialization failed
org.apache.shiro.config.ConfigurationException: Unable to instantiate class [org.nutz.plugins.cache.impl.redis.RedisCacheManager] for object named 'cacheManager_redis'.  Please ensure you've specified the fully qualified class name correctly.
	at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:309)
	at org.apache.shiro.config.ReflectionBuilder$InstantiationStatement.doExecute(ReflectionBuilder.java:927)
	at org.apache.shiro.config.ReflectionBuilder$Statement.execute(ReflectionBuilder.java:887)
	at org.apache.shiro.config.ReflectionBuilder$BeanConfigurationProcessor.execute(ReflectionBuilder.java:765)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:260)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:167)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:130)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:108)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:94)
	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:4973)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1740)
	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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
	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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	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: org.apache.shiro.util.UnknownClassException: Unable to load class named [org.nutz.plugins.cache.impl.redis.RedisCacheManager] from the thread context, current, or system/application ClassLoaders.  All heuristics have been exhausted.  Class could not be found.
	at org.apache.shiro.util.ClassUtils.forName(ClassUtils.java:152)
	at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:168)
	at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:302)
	... 64 more
ClassLoaderLeakPreventorListener: Settings for se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventorListener (CL: 0x178f450):
ClassLoaderLeakPreventorListener:   stopThreads = true
ClassLoaderLeakPreventorListener:   stopTimerThreads = true
ClassLoaderLeakPreventorListener:   executeShutdownHooks = true
ClassLoaderLeakPreventorListener:   threadWaitMs = 5000 ms
ClassLoaderLeakPreventorListener:   shutdownHookWaitMs = 10000 ms

maven的配置

<!--redis配置-->
    <dependency>
      <groupId>redis.clients</groupId>
      <artifactId>jedis</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz-integration-jedis</artifactId>
      <version>1.r.66-SNAPSHOT</version>
    </dependency>

<!--配置shiro权限管理及管理session同步-->
    <dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz-integration-shiro</artifactId>
      <version>1.r.60</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-all</artifactId>
      <version>1.3.0</version>
      <exclusions>
        <exclusion>
          <artifactId>ehcache-core</artifactId>
          <groupId>net.sf.ehcache</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache</artifactId>
      <version>2.10.2.2.21</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-ehcache</artifactId>
      <version>1.3.2</version>
    </dependency>

把导入的包改下就可以了

<!--配置shiro权限管理及管理session同步-->
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-web</artifactId>
      <version>1.3.2</version>
    </dependency>
    <dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz-integration-shiro</artifactId>
      <version>1.r.60</version>
    </dependency>
    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache</artifactId>
      <version>2.10.4</version>
    </dependency>
    <dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz-plugins-cache</artifactId>
      <version>1.r.66-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-ehcache</artifactId>
      <version>1.3.2</version>
    </dependency>

这样才可以,但是出现了新问题,一波三折啊

DXJ50: 2018-04-17 12:43:20,079 [MyScheduler_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
DXJ50: 2018-04-17 12:43:25,688 [http-apr-8080-exec-10] DEBUG org.apache.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [88f1dae1-d1df-41b7-909f-c0741daeeba0]
DXJ50: 2018-04-17 12:43:25,690 [http-apr-8080-exec-10] DEBUG net.sf.ehcache.store.disk.Segment - put added 0 on heap
DXJ50: 2018-04-17 12:43:25,690 [http-apr-8080-exec-10] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on heap
DXJ50: 2018-04-17 12:43:25,690 [http-apr-8080-exec-10] DEBUG org.nutz.plugins.cache.impl.redis.RedisCache2 - SET key=shiro-activeSessionCache:88f1dae1-d1df-41b7-909f-c0741daeeba0
DXJ50: 2018-04-17 12:43:25,692 [shiro-active%0053ession%0043ache.data] ERROR net.sf.ehcache.store.disk.DiskStorageFactory - Disk Write of 88f1dae1-d1df-41b7-909f-c0741daeeba0 failed: 
java.io.NotSerializableException: com.hxd.Auth
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
	at java.util.HashMap.writeObject(HashMap.java:1362)
	at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at org.apache.shiro.session.mgt.SimpleSession.writeObject(SimpleSession.java:461)
	at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
	at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:441)
	at net.sf.ehcache.Element.writeObject(Element.java:875)
	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryEfficientByteArrayOutputStream.java:97)
	at net.sf.ehcache.store.disk.DiskStorageFactory.serializeElement(DiskStorageFactory.java:403)
	at net.sf.ehcache.store.disk.DiskStorageFactory.write(DiskStorageFactory.java:385)
	at net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call(DiskStorageFactory.java:477)
	at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1071)
	at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1055)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	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)
DXJ50: 2018-04-17 12:43:25,694 [http-apr-8080-exec-10] INFO  org.nutz.plugins.cache.serializer.DefaultJdkSerializer - Object to bytes fail
java.io.NotSerializableException: com.hxd.Auth
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
	at java.util.HashMap.writeObject(HashMap.java:1362)
	at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at org.apache.shiro.session.mgt.SimpleSession.writeObject(SimpleSession.java:461)
	at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeUnshared(ObjectOutputStream.java:415)
	at org.nutz.plugins.cache.serializer.DefaultJdkSerializer.fromObject(DefaultJdkSerializer.java:20)
	at org.nutz.plugins.cache.impl.redis.RedisCache2.put(RedisCache2.java:50)
	at org.nutz.plugins.cache.impl.lcache.LCache.put(LCache.java:44)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:247)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:235)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.update(CachingSessionDAO.java:280)
	at org.apache.shiro.session.mgt.DefaultSessionManager.onChange(DefaultSessionManager.java:212)
	at org.apache.shiro.session.mgt.AbstractNativeSessionManager.touch(AbstractNativeSessionManager.java:233)
	at org.apache.shiro.session.mgt.DelegatingSession.touch(DelegatingSession.java:120)
	at org.apache.shiro.session.ProxiedSession.touch(ProxiedSession.java:100)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.updateSessionLastAccessTime(AbstractShiroFilter.java:315)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:364)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	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)
DXJ50: 2018-04-17 12:43:25,709 [http-apr-8080-exec-10] ERROR org.apache.shiro.web.servlet.AbstractShiroFilter - session.touch() method invocation has failed.  Unable to updatethe corresponding session's last access time based on the incoming request.
java.lang.NullPointerException
	at redis.clients.jedis.Protocol.sendCommand(Protocol.java:99)
	at redis.clients.jedis.Protocol.sendCommand(Protocol.java:84)
	at redis.clients.jedis.Connection.sendCommand(Connection.java:127)
	at redis.clients.jedis.BinaryClient.set(BinaryClient.java:110)
	at redis.clients.jedis.BinaryJedis.set(BinaryJedis.java:210)
	at org.nutz.plugins.cache.impl.redis.RedisCache2.put(RedisCache2.java:54)
	at org.nutz.plugins.cache.impl.lcache.LCache.put(LCache.java:44)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:247)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.cache(CachingSessionDAO.java:235)
	at org.apache.shiro.session.mgt.eis.CachingSessionDAO.update(CachingSessionDAO.java:280)
	at org.apache.shiro.session.mgt.DefaultSessionManager.onChange(DefaultSessionManager.java:212)
	at org.apache.shiro.session.mgt.AbstractNativeSessionManager.touch(AbstractNativeSessionManager.java:233)
	at org.apache.shiro.session.mgt.DelegatingSession.touch(DelegatingSession.java:120)
	at org.apache.shiro.session.ProxiedSession.touch(ProxiedSession.java:100)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.updateSessionLastAccessTime(AbstractShiroFilter.java:315)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:364)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	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)

貌似是获取session中的值空指针

java.io.NotSerializableException: com.hxd.Auth

放到session的对象都要实现序列化接口

成功了,好幸苦,哈哈。但是不知道怎么设置session的过期时间呢

shiro.ini里面

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