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. javascript - 关于jsp中嵌入js代码的问题2. javascript - 百度坐标,返回目标附近有哪些坐标3. PHP类中的$this4. javascript - html5多个label中其中一个触发change,如何判断是哪一个出发了change5. angular.js - angurlarJS的安卓的微信端中用加载ngCookies会出错的问题6. clone - git sourceTree克隆仓库时,都不停弹出Password Required弹窗,即时输入正确的git账号密码还是弹出7. python - 怎么通过vpn连内网ftp?8. javascript - 一个JS多元运算符的问题9. javascript - 关于fullpage.js的横向滚动控制10. python 正则表达式提取

网公网安备