开发者社区 问答 正文

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$Config

jedis.jar的版本是2.1.0

展开
收起
a123456678 2016-06-29 10:11:08 3057 分享 版权
1 条回答
写回答
取消 提交回答
  • 没错,commons-pool这个依赖包必须添加上,否则代码是对的也报错

    2019-07-17 19:48:48
    赞同 展开评论