记一次tomcat session redis共享报错 Could not get a resource from the pool



    HTTP状态 500 - 内部服务器错误
    


    

HTTP状态 500 - 内部服务器错误


    

    

类型 异常报告


    

消息 javax.servlet.ServletException: redis.clients.jedis.exceptions.JedisConnectionException: Could not get
        a resource from the pool


    

描述 服务器遇到一个意外的情况,阻止它完成请求。


    

例外情况


    
org.apache.jasper.JasperException: javax.servlet.ServletException: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:623)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:489)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    filter.CORSFilter.doFilter(CORSFilter.java:34)

    

根本原因。


    
javax.servlet.ServletException: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    org.apache.jsp.mall_jsp._jspService(mall_jsp.java:228)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    filter.CORSFilter.doFilter(CORSFilter.java:34)

    

根本原因。


    
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    redis.clients.util.Pool.getResource(Pool.java:53)
    redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
    redis.clients.jedis.JedisPool.getResource(JedisPool.java:12)
    com.seejoke.tomcat.redissessions.RedisSessionManager.acquireConnection(RedisSessionManager.java:186)
    com.seejoke.tomcat.redissessions.RedisSessionManager.createSession(RedisSessionManager.java:320)
    org.apache.catalina.connector.Request.doGetSession(Request.java:3112)
    org.apache.catalina.connector.Request.getSession(Request.java:2492)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:920)
    org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:130)
    org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:109)
    org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:59)
    org.apache.jsp.mall_jsp._jspService(mall_jsp.java:125)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    filter.CORSFilter.doFilter(CORSFilter.java:34)

    

根本原因。


    
redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset
    redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:202)
    redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
    redis.clients.jedis.Protocol.process(Protocol.java:147)
    redis.clients.jedis.Protocol.read(Protocol.java:211)
    redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
    redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:196)
    redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2049)
    redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:89)
    org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:836)
    org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:434)
    org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)
    redis.clients.util.Pool.getResource(Pool.java:49)
    redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
    redis.clients.jedis.JedisPool.getResource(JedisPool.java:12)
    com.seejoke.tomcat.redissessions.RedisSessionManager.acquireConnection(RedisSessionManager.java:186)
    com.seejoke.tomcat.redissessions.RedisSessionManager.createSession(RedisSessionManager.java:320)
    org.apache.catalina.connector.Request.doGetSession(Request.java:3112)
    org.apache.catalina.connector.Request.getSession(Request.java:2492)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:920)
    org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:130)
    org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:109)
    org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:59)
    org.apache.jsp.mall_jsp._jspService(mall_jsp.java:125)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    filter.CORSFilter.doFilter(CORSFilter.java:34)

    

根本原因。


    
java.net.SocketException: Connection reset
    java.net.SocketInputStream.read(SocketInputStream.java:210)
    java.net.SocketInputStream.read(SocketInputStream.java:141)
    java.net.SocketInputStream.read(SocketInputStream.java:127)
    redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:196)
    redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
    redis.clients.jedis.Protocol.process(Protocol.java:147)
    redis.clients.jedis.Protocol.read(Protocol.java:211)
    redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
    redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:196)
    redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2049)
    redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:89)
    org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:836)
    org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:434)
    org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)
    redis.clients.util.Pool.getResource(Pool.java:49)
    redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)
    redis.clients.jedis.JedisPool.getResource(JedisPool.java:12)
    com.seejoke.tomcat.redissessions.RedisSessionManager.acquireConnection(RedisSessionManager.java:186)
    com.seejoke.tomcat.redissessions.RedisSessionManager.createSession(RedisSessionManager.java:320)
    org.apache.catalina.connector.Request.doGetSession(Request.java:3112)
    org.apache.catalina.connector.Request.getSession(Request.java:2492)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:920)
    org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:130)
    org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:109)
    org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:59)
    org.apache.jsp.mall_jsp._jspService(mall_jsp.java:125)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    filter.CORSFilter.doFilter(CORSFilter.java:34)

    

):注意 主要问题的全部 stack 信息可以在 server logs 里查看


    

    

Apache Tomcat/9.0.71


我的配置

   
   
    WEB-INF/web.xml
    WEB-INF/tomcat-web.xml
    ${catalina.base}/conf/web.xml
    
     
               host="xxx.xxx.xxx.xx"
          port="6379"
          database="0" 
          password="mogu2018"
          maxInactiveInterval="1800" /> 

   
   

 

 

tomcat启动日志;

12-Jun-2023 11:00:57.076 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin Match [Context/Manager] failed to set property [maxInactiveInterval] to [1800]
 

一直以为是这个maxInactiveInterval 失效引起的,但是之前用的好好的。

改源码写死还是这样,

突然发现配置的IP是公网IP,改为内网IP之后就正常了。

阿里云真的很奇怪。

你可能感兴趣的:(html,服务器,javascript)