java-ee - redis java客戶端不能創(chuàng)建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編譯有八阿哥。
相關(guān)文章:
1. docker-compose中volumes的問題2. java - SSH框架中寫分頁時service層中不能注入分頁類3. boot2docker無法啟動4. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.5. javascript - vue生成一維碼?求助!?。。?!急6. nignx - docker內(nèi)nginx 80端口被占用7. javascript - mock.js可以存儲數(shù)據(jù)嗎8. docker網(wǎng)絡(luò)端口映射,沒有方便點的操作方法么?9. javascript - js如何獲取app保存的TOKEN?10. 老師,按tab鍵不起作用怎么回事

網(wǎng)公網(wǎng)安備