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. Span标签2. css - 求推荐适用于vue2的框架 像bootstrap这种类型的3. docker-machine添加一个已有的docker主机问题4. css - 关于div自适应问题,大家看图吧,说不清5. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””6. SessionNotFoundException:会话ID为null。调用quit()后使用WebDriver吗?(硒)7. android新手一枚,android使用httclient获取服务器端数据失败,但是用java工程运行就可以成功获取。8. angular.js使用$resource服务把数据存入mongodb的问题。9. java - Collections类里的swap函数,源码为什么要新定义一个final的List型变量l指向传入的list?10. python - django如何每次调用标签的时候都取随机数据
