NutzCN Logo
问答 nutz/integration/jedis/RedisService 使用报错
发布于 14天前 作者 qq_a930202f 85 次浏览 复制 上一个帖子 下一个帖子
标签:

因为在非IOC环境使用,所以用了Mvcs.ctx().getDefaultIoc().get(RedisService.class)的方式,报错信息

redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:256) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:16) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.Jedis.close(Jedis.java:3409) ~[jedis-2.9.0.jar:?]
	at org.nutz.lang.Streams.safeClose(Streams.java:392) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.integration.jedis.RedisService.get(RedisService.java:85) ~[nutz-integration-jedis-1.r.66.jar:?]
	at com.bsd.security.shiro.RetryLimitHashedCredentialsMatcher.doCredentialsMatch(RetryLimitHashedCredentialsMatcher.java:63) ~[classes/:?]
	at org.apache.shiro.realm.AuthenticatingRealm.assertCredentialsMatch(AuthenticatingRealm.java:600) ~[shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:581) ~[shiro-core-1.4.0.jar:1.4.0]
	at com.bsd.security.shiro.ModularRealmAuthenticator2.doMultiRealmAuthentication(ModularRealmAuthenticator2.java:49) [classes/:?]
	at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:269) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:274) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:260) [shiro-core-1.4.0.jar:1.4.0]
	at com.bsd.back.LoginAction.login(LoginAction.java:120) [classes/:?]
	at com.bsd.LoginAction$$NUTZAOP._aop_invoke(LoginAction.java:1) [nutz-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.integration.jedis.RedisInterceptor.filter(RedisInterceptor.java:24) [nutz-integration-jedis-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.plugins.slog.aop.SlogAopInterceptor.filter(SlogAopInterceptor.java:68) [nutz-plugins-slog-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.LoginAction$$NUTZAOP.login(LoginAction.java:1) [nutz-1.r.66.jar:?]
	at com.bsd.LoginAction$FM$login$03b79338e2265dcddcf246ee8ef707e7.invoke(LoginAction.java) [nutz-1.r.66.jar:?]
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.CSRFProtectPostProcessor.process(CSRFProtectPostProcessor.java:16) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.CSRFProtectPreProcessor.process(CSRFProtectPreProcessor.java:19) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:39) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.XSSProtectProcessor.process(XSSProtectProcessor.java:16) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.LogTimeProcessor.process(LogTimeProcessor.java:23) [classes/:?]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) [nutz-1.r.66.jar:1.r.66]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.bufferAndPostProcess(ContentBufferingFilter.java:169) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ContentBufferingFilter.java:126) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:120) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163) [sitemesh-3.0.1.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.10.jar:1.1.10]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.11.0.jar:2.11.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.31]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.31]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.31]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.31]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.31]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-coyote.jar:8.5.31]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.31]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-coyote.jar:8.5.31]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-coyote.jar:8.5.31]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.31]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.31]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
Caused by: redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.util.Pool.returnResourceObject(Pool.java:69) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:253) ~[jedis-2.9.0.jar:?]
	... 93 more
Caused by: java.lang.IllegalStateException: Object has already been returned to this pool or is invalid
	at org.apache.commons.pool2.impl.GenericObjectPool.returnObject(GenericObjectPool.java:551) ~[commons-pool2-2.4.2.jar:2.4.2]
	at redis.clients.util.Pool.returnResourceObject(Pool.java:67) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:253) ~[jedis-2.9.0.jar:?]
	... 93 more
[02:41:48:824] [WARN] - org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:216) - Authentication failed for token submission [com.bsd.security.shiro.authc.FormToken - abc, rememberMe=false (0:0:0:0:0:0:0:1)].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:256) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:16) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.Jedis.close(Jedis.java:3409) ~[jedis-2.9.0.jar:?]
	at org.nutz.lang.Streams.safeClose(Streams.java:392) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.integration.jedis.RedisService.get(RedisService.java:85) ~[nutz-integration-jedis-1.r.66.jar:?]
	at com.bsd.security.shiro.RetryLimitHashedCredentialsMatcher.doCredentialsMatch(RetryLimitHashedCredentialsMatcher.java:63) ~[classes/:?]
	at org.apache.shiro.realm.AuthenticatingRealm.assertCredentialsMatch(AuthenticatingRealm.java:600) ~[shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:581) ~[shiro-core-1.4.0.jar:1.4.0]
	at com.bsd.security.shiro.ModularRealmAuthenticator2.doMultiRealmAuthentication(ModularRealmAuthenticator2.java:49) ~[classes/:?]
	at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:269) ~[shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:274) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:260) [shiro-core-1.4.0.jar:1.4.0]
	at com.t.app.web.back.LoginAction.login(LoginAction.java:120) [classes/:?]
	at com.t.app.web.back.LoginAction$$NUTZAOP._aop_invoke(LoginAction.java:1) [nutz-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.integration.jedis.RedisInterceptor.filter(RedisInterceptor.java:24) [nutz-integration-jedis-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.plugins.slog.aop.SlogAopInterceptor.filter(SlogAopInterceptor.java:68) [nutz-plugins-slog-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) [nutz-1.r.66.jar:1.r.66]
	at com.t.app.web.back.LoginAction$$NUTZAOP.login(LoginAction.java:1) [nutz-1.r.66.jar:?]
	at com.t.app.web.back.LoginAction$FM$login$03b79338e2265dcddcf246ee8ef707e7.invoke(LoginAction.java) [nutz-1.r.66.jar:?]
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.CSRFProtectPostProcessor.process(CSRFProtectPostProcessor.java:16) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.CSRFProtectPreProcessor.process(CSRFProtectPreProcessor.java:19) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:39) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.XSSProtectProcessor.process(XSSProtectProcessor.java:16) [classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) [nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.LogTimeProcessor.process(LogTimeProcessor.java:23) [classes/:?]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) [nutz-1.r.66.jar:1.r.66]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.bufferAndPostProcess(ContentBufferingFilter.java:169) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ContentBufferingFilter.java:126) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:120) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163) [sitemesh-3.0.1.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.10.jar:1.1.10]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.11.0.jar:2.11.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.31]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.31]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.31]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.31]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.31]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-coyote.jar:8.5.31]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.31]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-coyote.jar:8.5.31]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-coyote.jar:8.5.31]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.31]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.31]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
Caused by: redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.util.Pool.returnResourceObject(Pool.java:69) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:253) ~[jedis-2.9.0.jar:?]
	... 93 more
Caused by: java.lang.IllegalStateException: Object has already been returned to this pool or is invalid
	at org.apache.commons.pool2.impl.GenericObjectPool.returnObject(GenericObjectPool.java:551) ~[commons-pool2-2.4.2.jar:2.4.2]
	at redis.clients.util.Pool.returnResourceObject(Pool.java:67) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:253) ~[jedis-2.9.0.jar:?]
	... 93 more
[02:41:48:826] [WARN] - org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/login :
redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.util.Pool.returnBrokenResourceObject(Pool.java:103) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnBrokenResource(JedisPool.java:239) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:255) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:16) ~[jedis-2.9.0.jar:?]
	at redis.clients.jedis.Jedis.close(Jedis.java:3409) ~[jedis-2.9.0.jar:?]
	at org.nutz.lang.Streams.safeClose(Streams.java:392) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.integration.jedis.RedisInterceptor.filter(RedisInterceptor.java:26) ~[nutz-integration-jedis-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.plugins.slog.aop.SlogAopInterceptor.filter(SlogAopInterceptor.java:68) ~[nutz-plugins-slog-1.r.66.jar:?]
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) ~[nutz-1.r.66.jar:1.r.66]
	at com.t.app.web.back.LoginAction$$NUTZAOP.login(LoginAction.java:1) ~[nutz-1.r.66.jar:?]
	at com.t.app.web.back.LoginAction$FM$login$03b79338e2265dcddcf246ee8ef707e7.invoke(LoginAction.java) ~[nutz-1.r.66.jar:?]
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) ~[nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.CSRFProtectPostProcessor.process(CSRFProtectPostProcessor.java:16) ~[classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.CSRFProtectPreProcessor.process(CSRFProtectPreProcessor.java:19) ~[classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:39) ~[classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.XSSProtectProcessor.process(XSSProtectProcessor.java:16) ~[classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.66.jar:1.r.66]
	at com.bsd.web.processor.LogTimeProcessor.process(LogTimeProcessor.java:23) ~[classes/:?]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.66.jar:1.r.66]
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) [nutz-1.r.66.jar:1.r.66]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.bufferAndPostProcess(ContentBufferingFilter.java:169) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ContentBufferingFilter.java:126) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:120) [sitemesh-3.0.1.jar:?]
	at org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163) [sitemesh-3.0.1.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.10.jar:1.1.10]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) [shiro-core-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.4.0.jar:1.4.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.11.0.jar:2.11.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.31]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.31]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [catalina.jar:8.5.31]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) [catalina.jar:8.5.31]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.31]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.31]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-coyote.jar:8.5.31]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.31]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-coyote.jar:8.5.31]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-coyote.jar:8.5.31]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.31]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.31]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
Caused by: java.lang.IllegalStateException: Invalidated object not currently part of this pool
	at org.apache.commons.pool2.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:640) ~[commons-pool2-2.4.2.jar:2.4.2]
	at redis.clients.util.Pool.returnBrokenResourceObject(Pool.java:101) ~[jedis-2.9.0.jar:?]
	... 81 more
7 回复

你这个不是ioc报错,是没连上redis

@Wizzercn 是可以连上的。
查了一圈,目前感觉是pool的资源没有释放。
具体原因还不确定

通过aop方式使用是正常的

测试改成用

Jedis jedis =  Mvcs.ctx().getDefaultIoc().get(JedisPool.class, "jedisPool").getResource()

是正常的,是不是RedisService有什么使用问题

你要是这样用的话,需要try catch 包起来

try (Jedis jedis = xxxxx.getResource()) {


}

@Wizzercn @wendal
有点晕,根据文档

16.1.4. 通过aop方式使用
必须是ioc bean对象哦,不然@Aop不会生效

import static org.nutz.integration.jedis.RedisInterceptor.jedis;
@Aop("redis") //拦截器的名字叫redis
public void addTopic(Topic topic) {
// 通过调用jedis()获取上下文的Jedis对象,无需手动关闭或回收.
jedis().set("topic:"+R.UU32(), Json.toJson(topic,JsonFormat.full()));
}

而我在一个没加@IocBean和@Aop("redis")的里面却可以正常使用jedis()

public class MyRealm extends AuthorizingRealm {

	@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) {
		jedis().exists(key)
	}
	
}

这是什么情况?

@qq_a930202f 你这样写 是可以用 但不会释放连接
aop的模式会帮你释放连接的

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