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. javascript - 微信網頁開發從菜單進入頁面后,按返回鍵沒有關閉瀏覽器而是刷新當前頁面,求解決?2. python - TypeError: tryMsgcode() takes exactly 2 arguments (0 given)3. 求救一下,用新版的phpstudy,數據庫過段時間會消失是什么情況?4. mysql - C#連接數據庫時一直這一句出問題int i = cmd.ExecuteNonQuery();5. mysql - ubuntu開啟3306端口失敗,有什么辦法可以解決?6. android - 安卓做前端,PHP做后臺服務器 有什么需要注意的?7. mysql replace 死鎖8. 環境搭建 - anaconda 創建python2.7環境中打開編譯器確是3.6版本9. extra沒有加載出來10. python - 數據與循環次數對應不上
