search

Home  >  Q&A  >  body text

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$Config

jedis.jar的版本是2.1.0
巴扎黑巴扎黑2799 days ago744

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-21 10:58:36

    Yes, the commons-pool dependency package must be added, otherwise the code will be correct and an error will be reported

    reply
    0
  • PHPz

    PHPz2017-04-21 10:58:36

    It turns out that I forgot to add commons-pool, the basic package of GenericObjectPool

    reply
    0
  • PHP中文网

    PHP中文网2017-04-21 10:58:36

    Update the redis client; the lower version of the redis client is compiled with Java8.

    reply
    0
  • Cancelreply