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. python开发的脚本想上个ui,用哪个库来绘制窗口比较好?求推荐2. java - JPA连接数据库,一段时间没有数据操作会关闭连接,再次访问就会抛出异常,如何解决?3. Mysql取下一条记录4. java - 关于i++的一个题目5. mysql federated引擎无法开启6. javascript 如何下载一个excel文件 ?7. Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()window()maximize();处获得自动化扩展8. sublime text 3不支持python的input吗9. 紧急求助-我们的一位同事突然离职,需要一个后端的同事,项目才能进行,停滞了,那位可以帮帮忙?10. python - 如何使用websocket在网页上动态示实时数据的折线图?

网公网安备