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. mysql - 記得以前在哪里看過一個估算時間的網站2. Span標簽3. Docker for Mac 創建的dnsmasq容器連不上/不工作的問題5. javascript - 能否讓vue-cli的express修改express重啟服務6. angular.js - angularjs如何傳遞id給另一個視圖 根據id獲取json數據?7. docker不顯示端口映射呢?8. 請教各位大佬,瀏覽器點 提交實例為什么沒有反應9. dockerfile - [docker build image失敗- npm install]10. javascript - 前端開發 本地靜態文件頻繁修改,預覽時的緩存怎么解決?
