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爬蟲如何爬取span和span中間的內容并分別存入字典里?2. mysql - 把一個表中的數據count更新到另一個表里?3. 請教使用PDO連接MSSQL數據庫插入是亂碼問題?4. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處5. visual-studio - Python OpenCV: 奇怪的自動補全問題6. 視頻文件不能播放,怎么辦?7. mysql 查詢身份證號字段值有效的數據8. linux - Ubuntu下編譯Vim8(+python)無數次編譯失敗9. node.js - nodejs開發中常用的連接mysql的庫10. python - 爬蟲模擬登錄后,爬取csdn后臺文章列表遇到的問題
