java-ee - redis java客户端不能创建JedisPool
问题描述
JedisPoolConfig config = new JedisPoolConfig(); config.setMaxActive(100);config.setMaxIdle(20);config.setMaxWait(1000l);config.setTestOnBorrow(true);JedisPool jedisPool= new JedisPool(config, 'localhost');
JedisPool jedisPool= new JedisPool(config, 'localhost');这句Eclipse总是报错,鼠标移到小红叉上提示:
Multiple markers at this line- The type org.apache.commons.pool.impl.GenericObjectPool$Config cannot be resolved. It is indirectly referenced from required .class files- The constructor JedisPool(GenericObjectPool$Config, String) refers to the missing type GenericObjectPool$Configjedis.jar的版本是2.1.0
问题解答
回答1:没错,commons-pool这个依赖包必须添加上,否则代码是对的也报错
回答2:原来是忘记添加GenericObjectPool的基本包commons-pool
回答3:更新redis client;低版本的redis clien在Jave8编译有八阿哥。
相关文章:
1. docker api 开发的端口怎么获取?2. node.js - 我是一个做前端的,求教如何学习vue,node等js引擎?3. android glide asbitmap 在baseadpter中的问题4. docker网络端口映射,没有方便点的操作方法么?5. docker镜像push报错6. php - MySQL数据库设计,获取点赞的人数7. css3 - 微信前端页面遇到的transition过渡动画的bug8. 老师,flex-shrink: 1; 按视频操作,不会自动缩放9. 请教python编码风格和异常处理问题10. cookies - python用cookie登录网站失败

网公网安备