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內創建jenkins訪問另一個容器下的服務器問題2. 如何解決Centos下Docker服務啟動無響應,且輸入docker命令無響應?3. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?4. javascript - js閉包作用域5. 極光推送 - Android app消息推送 百度 極光 個推 信鴿哪個好一些?6. html5 - 百度echart官網下載的地圖json數據亂碼7. css3 - 學習css構建圖形時,遇到一個很有意思的現象,具體代碼如下8. html - css 使用字體的時候,格式有什么特殊要求嗎?9. 微信開放平臺 - android 微信支付后點完成按鈕,后回調打開第三方頁面,屏幕閃動,求解決方法10. javascript - echart+百度地圖
