您的位置:首頁技術文章
文章詳情頁

java-ee - redis java客戶端不能創建JedisPool

瀏覽:59日期:2023-08-25 08:19:06

問題描述

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編譯有八阿哥。

標簽: java
相關文章:
国产综合久久一区二区三区