suchen

Heim  >  Fragen und Antworten  >  Hauptteil

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
巴扎黑巴扎黑2829 Tage vor762

Antworte allen(3)Ich werde antworten

  • 怪我咯

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

    没错,commons-pool这个依赖包必须添加上,否则代码是对的也报错

    Antwort
    0
  • PHPz

    PHPz2017-04-21 10:58:36

    原来是忘记添加GenericObjectPool的基本包commons-pool

    Antwort
    0
  • PHP中文网

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

    更新redis client;低版本的redis clien在Jave8编译有八阿哥。

    Antwort
    0
  • StornierenAntwort