首页

通过jedis连接redis服务报“JedisDataException: ERR operation not permitted”错误异常

标签:jedis,redis,客户端,异常,exception,dump.rdb,配置     发布时间:2017-01-15   

一、异常描述

通过jedis客户端代码连接redis服务因默认为操作系统目录(非授权写入操作),报出异常"redis.clients.jedis.exceptions.JedisDataException: ERR operation not permitted"日志,详情如下所示

redis.clients.jedis.exceptions.JedisDataException: ERR operation not permitted@b@	at redis.clients.jedis.Protocol.processError(Protocol.java:115)@b@	at redis.clients.jedis.Protocol.process(Protocol.java:133)@b@	at redis.clients.jedis.Protocol.read(Protocol.java:202)@b@	at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:285)@b@	at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:204)@b@	at redis.clients.jedis.Connection.getBulkReply(Connection.java:193)@b@	at redis.clients.jedis.Jedis.get(Jedis.java:101)@b@	at com.xwood.demo.util.JedisUtil.get(JedisUtil.java:29)@b@	at com.xwood.demo.dev.poweroff.linux.LinuxRemotePowerOffService.invoke(LinuxRemotePowerOffService.java:86)@b@	at com.xwood.demo.gw.GatewayServlet.doPost(GatewayServlet.java:68)@b@	at com.xwood.demo.gw.GatewayServlet.doGet(GatewayServlet.java:55)@b@	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)@b@	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)@b@	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)@b@	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)@b@	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)@b@	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)@b@	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)@b@	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)@b@	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)@b@	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)@b@	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)@b@	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)@b@	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)@b@	at java.lang.Thread.run(Thread.java:745)

二、解决步骤

1. 在redis服务目录下设置redis.conf文件,找到dbfilename  dump.rdb行修改为授权目录(E:/xwood/redis-db/,根据实际情况设置),如修改如下

#  ...@b@@b@# The filename where to dump the DB@b@dbfilename  dump.rdb@b@@b@# ...

修改为

#  ...@b@@b@# The filename where to dump the DB@b@dbfilename  E:/xwood/redis-db/dump.rdb@b@@b@# ...

2. 重启redis服务,问题解决了

<<热门下载>>