这里我正在尝试创建新的JedisPool,但是我收到以下错误。
The constructor JedisPool(GenericObjectPool$Config, String, int, int) refers to the missing type GenericObjectPool$Config
这个程序:
package redis_openfire;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
public class pubs {
public static final String CHANNEL_NAME = "commonChannel";
// private static Logger logger = LoggerFactory.getLogger(pubs.class);
private static Jedis publisherJedis;
public static void main(String[] args) {
final JedisPoolConfig poolConfig = new JedisPoolConfig();
final JedisPool jedisPool = new JedisPool(poolConfig, "localhost", 6379, 0);
publisherJedis = jedisPool.getResource();
publisherJedis.publish(CHANNEL_NAME, "this is...");
}
}
答案 0 :(得分:2)
我认为您需要将commons-pool添加到类路径中,因为JedisPool是公共池支持的实现