redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: 权限不够

时间:2022-09-18 17:26:52

异常信息

HTTP Status 500 - Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: 权限不够 (connect failed)

type Exception report

message Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: 权限不够 (connect failed)

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

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: 权限不够 (connect failed)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:986)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: 权限不够 (connect failed)
    redis.clients.jedis.Connection.connect(Connection.java:207)
    redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93)
    redis.clients.jedis.Connection.sendCommand(Connection.java:126)
    redis.clients.jedis.Connection.sendCommand(Connection.java:117)
    redis.clients.jedis.BinaryClient.auth(BinaryClient.java:564)
    redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2138)
    com.devcoms.web.controller.HomeController.Index(HomeController.java:42)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:498)
    org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:871)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:777)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.net.ConnectException: 权限不够 (connect failed)
    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:184)
    redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93)
    redis.clients.jedis.Connection.sendCommand(Connection.java:126)
    redis.clients.jedis.Connection.sendCommand(Connection.java:117)
    redis.clients.jedis.BinaryClient.auth(BinaryClient.java:564)
    redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2138)
    com.devcoms.web.controller.HomeController.Index(HomeController.java:42)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:498)
    org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:871)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:777)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.76 logs.

Apache Tomcat/7.0.76

摸索

翻遍了各种搜索引擎,就没遇到过说权限不够的

1 修改服务运行用户为root

没效果

2 给tomcat所有相关的目录授权

没效果

3 修改tomcat配置文件,注入jvm参数

没效果

解决

也不算是解决了,是放弃了

原来 tomcat 是用 yum 安装的

换成官方的安装包,或编译安装都可以,就没有权限问题了

到最后我也没搞清楚啥原因,有时间了在继续研究

记得添加tomcat运行用户

groupadd tomcat
useradd -g tomcat -s /usr/sbin/nologin tomcat