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. golang - 用IDE看docker源碼時的小問題2. docker-compose中volumes的問題3. docker安裝后出現Cannot connect to the Docker daemon.4. 在windows下安裝docker Toolbox 啟動Docker Quickstart Terminal 失敗!5. javascript - 最近用echarts做統計圖時遇到兩個問題!!6. docker內創建jenkins訪問另一個容器下的服務器問題7. docker容器呢SSH為什么連不通呢?8. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?9. docker不顯示端口映射呢?10. mac里的docker如何命令行開啟呢?

網公網安備