java-ee - redis java客戶端不能創(chuàng)建JedisPool
問(wèn)題描述
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總是報(bào)錯(cuò),鼠標(biāo)移到小紅叉上提示:
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
問(wèn)題解答
回答1:沒(méi)錯(cuò),commons-pool這個(gè)依賴包必須添加上,否則代碼是對(duì)的也報(bào)錯(cuò)
回答2:原來(lái)是忘記添加GenericObjectPool的基本包c(diǎn)ommons-pool
回答3:更新redis client;低版本的redis clien在Jave8編譯有八阿哥。
相關(guān)文章:
1. javascript - vscode alt+shift+f 格式化js代碼,通不過(guò)eslint的代碼風(fēng)格檢查怎么辦。。。2. javascript - [js]為什么畫(huà)布里不出現(xiàn)圖片呢?在線等3. python - 如何判斷爬蟲(chóng)已經(jīng)成功登陸?4. html - vue項(xiàng)目中用到了elementUI問(wèn)題5. html5 - 有可以一次性把所有 css外部樣式轉(zhuǎn)為html標(biāo)簽內(nèi)style=" "的方法嗎?6. javascript - 如何將一個(gè)div始終固定在某個(gè)位置;無(wú)論屏幕和分辨率怎么變化;div位置始終不變7. javascript - 原生canvas中如何獲取到觸摸事件的canvas內(nèi)坐標(biāo)?8. javascript - 有什么比較好的網(wǎng)頁(yè)版shell前端組件?9. javascript - 這不是對(duì)象字面量函數(shù)嗎?為什么要new初始化?10. javascript - 求解答:實(shí)例對(duì)象調(diào)用constructor,此時(shí)constructor內(nèi)的this的指向?
