当前位置: 首页 > news >正文

凡科轻站链爱交易平台

凡科轻站,链爱交易平台,望牛墩镇仿做网站,做ppt网站有哪些内容redis报错汇总 在单元测试时#xff0c;使用jedis通常遇到如下报错#xff1a; 实例化报错-连接报错-权限报错。此报错是有顺序的#xff1a;例如#xff0c;若连接报错#xff0c;说明实例化完成#xff0c;即配置文件配对了。若权限报错#xff0c;说明连接…redis报错汇总 在单元测试时使用jedis通常遇到如下报错 实例化报错-连接报错-权限报错。此报错是有顺序的例如若连接报错说明实例化完成即配置文件配对了。若权限报错说明连接通了但密码错误。若实例化就报错说明配置文件配错了没法启动redis客户端更别说去连接了。 具体报错如下 1.实例化报错 Failed to load ApplicationContext. Error creating bean with name jedisPool defined in class path resource [applicationContext-redis.xml]: Unsatisfied dependency expressed through constructor parameter 0: Ambiguous argument values for parameter of type [org.apache.commons.pool2.impl.GenericObjectPoolConfig] - did you specify the correct bean references as arguments? 出现此错误通常是配置文件出错配置JedisPool出错。 2.连接报错 connect timed out 出现此错误通常是网络问题。一般在公司里内网外网防火墙等各种网络情况。记得切换网络。 3.权限报错 1.没有配置password如果需要密码 NOAUTH Authentication required. 出现此错误说明配置文件没有配password。 2.密码错误 ERR invalid password 出现此错误说明密码错了。 需要注意 如下配置是错误的这也是导致实例化报错的主要原因。 bean idjedisPool classredis.clients.jedis.JedisPoolconstructor-arg namehost value192.168.100.12/constructor-arg nameport value6379/constructor-arg namepassword valuexxx//bean 查看jedis源码发现设置密码JedisPool的构造参数如下 public JedisPool(GenericObjectPoolConfig poolConfig, String host, int port, int timeout, String password) {this(poolConfig, host, port, timeout, password, 0, (String)null);} 即需要配置如下参数 bean classredis.clients.jedis.JedisPool idjedisPool constructor-arg namehost value192.168.100.12/constructor-argconstructor-arg nameport value6379/constructor-argconstructor-arg namepassword valuexxx/constructor-argconstructor-arg nametimeout value3000/constructor-argconstructor-arg namepoolConfig refjedisPoolConfig/constructor-arg/beanbean classredis.clients.jedis.JedisPoolConfig idjedisPoolConfigproperty namemaxIdle value300 /property namemaxTotal value1000 /property namemaxWaitMillis value1000 /property nametestOnBorrow valuefalse /property nameblockWhenExhausted valuefalse //bean 如果redis没有设置密码的话配置就可以很简单 bean idjedisPool classredis.clients.jedis.JedisPoolconstructor-arg namehost value192.168.100.12/constructor-arg nameport value6379//bean 因为JedisPool提供了只需要ip地址和端口的构造参数如下 public JedisPool(String host, int port) {this(new GenericObjectPoolConfig(), host, port, 2000, (String)null, 0, (String)null);}补充 bean的xml文件格式 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd!-- 这中间写bean -- !-- bean idjedisPool classredis.clients.jedis.JedisPool-- !-- constructor-arg namehost value192.168.100.12/-- !-- constructor-arg nameport value6379/-- !-- /bean--/beans 单元测试类 RunWith(SpringRunner.class)//spring整合JUnit4 ContextConfiguration(locations{classpath:applicationContext-redis.xml})//加载spring配置文件 public class BaseRedisTest { } 分割线 文章到此已经结束以下是紫薯布丁 Failed to load ApplicationContext. Error creating bean with name jedisPool defined in class path resource [applicationContext-redis.xml]:  Unsatisfied dependency expressed through constructor parameter 0:  Ambiguous argument values for parameter of type [org.apache.commons.pool2.impl.GenericObjectPoolConfig]  - did you specify the correct bean references as arguments? connect timed out NOAUTH Authentication required. ERR invalid password bean idjedisPool classredis.clients.jedis.JedisPool         constructor-arg namehost value192.168.100.12/         constructor-arg nameport value6379/         constructor-arg namepassword valuexxx/     /bean public JedisPool(GenericObjectPoolConfig poolConfig, String host, int port, int timeout, String password) {         this(poolConfig, host, port, timeout, password, 0, (String)null);     } bean classredis.clients.jedis.JedisPool idjedisPool         constructor-arg namehost value192.168.100.12/constructor-arg         constructor-arg nameport value6379/constructor-arg         constructor-arg namepassword valuexxx/constructor-arg         constructor-arg nametimeout value3000/constructor-arg         constructor-arg namepoolConfig refjedisPoolConfig/constructor-arg     /bean     bean classredis.clients.jedis.JedisPoolConfig idjedisPoolConfig         property namemaxIdle value300 /         property namemaxTotal value1000 /         property namemaxWaitMillis value1000 /         property nametestOnBorrow valuefalse /         property nameblockWhenExhausted valuefalse /     /bean bean idjedisPool classredis.clients.jedis.JedisPool         constructor-arg namehost value192.168.100.12/         constructor-arg nameport value6379/     /bean public JedisPool(String host, int port) {         this(new GenericObjectPoolConfig(), host, port, 2000, (String)null, 0, (String)null);     }   ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans        xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance        xsi:schemaLocationhttp://www.springframework.org/schema/beans        http://www.springframework.org/schema/beans/spring-beans.xsd !-- 这中间写bean -- !--    bean idjedisPool classredis.clients.jedis.JedisPool-- !--        constructor-arg namehost value192.168.100.12/-- !--        constructor-arg nameport value6379/-- !--    /bean-- /beans RunWith(SpringRunner.class)//spring整合JUnit4 ContextConfiguration(locations{classpath:applicationContext-redis.xml})//加载spring配置文件 public class BaseRedisTest { }
http://www.hkea.cn/news/14310774/

相关文章:

  • 郴州网站建设公司哪个好html网站自带字体怎么做
  • 网站建设从哪几个情况去判天元建设集团有限公司六大板块
  • 深圳网站建设799元起全包域名重庆做手机网站建设
  • 如何编写网站建设公司简介模板及介绍
  • 保定网站建设制作开发平台电商平台寻求供货商
  • 网站布局设计软件营销必备十大软件
  • 杭州网站建设的企业沈阳视频制作公司
  • 在哪能学到网站建设工商企业登记查询
  • html网站设计模板哪里有网站建设中心
  • 建立网站怎么赚钱北京顺义去哪找做网站的
  • 品牌网站建设费用网站开发 .net
  • 简单php企业网站源码dw简易网站怎么做
  • 杭州网站建设价格企业管理咨询管理公司在哪
  • 长春网站建设选择星宿科技河南网站顾问
  • 做机械产品用什么网站注册网站在哪里创建
  • 网站设计与制作是做什么工作郑州做网站推广
  • 两学一做网站飘窗网红推广团队去哪里找
  • 长沙的互联网网站公司做品管圈网站
  • 使用oss做静态网站企业宣传片模板直接套用
  • 有做学历在网站能查的到的九江seo优化
  • 定制网站制作服务商做亚马逊一年赚了60万
  • 做石油期货看什么网站东莞网站优化推广方案
  • 签证中心网站建设免费咨询宠物医生在线
  • 教育类手机网站模板丽水专业网站建设哪家好
  • 免费电视剧网站大全在线观看施工企业经营情况汇报材料
  • 有没有做语文题的网站河北住房城乡建设厅官方网站
  • app建设网站公司简介切图网站建设
  • flash网站系统游戏在线玩
  • html5网站建设加盟58网站开发要多少钱
  • c2c网站建设系统网站软件有哪些