1.报错前配置,云服务器一台,使用Nginx负载两个Tomcat服务(同一IP不同端口8080、8081)。配置两个Tomcat的context.xml前项目正常可访问,配置后添加了Redis做共享的Valve Manager 后报错,如下
<Valve className="tomcat.request.session.redis.SessionHandlerValve" />
<Manager className="tomcat.request.session.redis.SessionManager"
host="49.233.153.118"
port="6379"
password="123456"
database="0"
maxInactiveInterval="7200"
/>
希望有解决方案的告知一下,非常感谢
2.报错内容:
[ERROR]-[Thread: http-nio-8081-exec-13]-[com.jfinal.core.ActionHandler.handle()]: com.gftrade.index.IndexController.index() : /
redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool
at redis.clients.util.Pool.getResource(Pool.java:51)
at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226)
at tomcat.request.session.data.cache.impl.RedisDataCache$RedisCacheUtil.setnx(RedisDataCache.java:271)
at tomcat.request.session.data.cache.impl.RedisDataCache.setnx(RedisDataCache.java:56)
at tomcat.request.session.redis.SessionManager.createSession(SessionManager.java:165)
at tomcat.request.session.redis.SessionManager.createSession(SessionManager.java:37)
at org.apache.catalina.connector.Request.doGetSession(Request.java:3059)
at org.apache.catalina.connector.Request.getSession(Request.java:2454)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:896)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
at com.jfinal.core.Controller.getSession(Controller.java:460)
at com.gftrade.common.base.BaseController.render(BaseController.java:414)
at com.gftrade.index.IndexController.index(IndexController.java:26)
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 com.jfinal.aop.Invocation.invoke(Invocation.java:97)
at com.jfinal.ext.interceptor.SessionInViewInterceptor.intercept(SessionInViewInterceptor.java:44)
at com.jfinal.aop.Invocation.invoke(Invocation.java:91)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:89)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
at tomcat.request.session.redis.SessionHandlerValve.invoke(SessionHandlerValve.java:37)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.NoSuchElementException: Unable to validate object
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:506)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericO