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下的nginx压力测试2. Docker for Mac 创建的dnsmasq容器连不上/不工作的问题3. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?4. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?5. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?6. javascript - vue的element-ui(饿了吗UI) webpack打包时externals无法分离7. docker-compose中volumes的问题8. docker start -a dockername 老是卡住,什么情况?9. docker容器呢SSH为什么连不通呢?10. docker网络端口映射,没有方便点的操作方法么?

网公网安备