I'm going to create a Jedis pool, (in a really simple way)
but I got this error below:
public static void main(String[] args) {
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxTotal(10);
new JedisPool(jedisPoolConfig, "localhost");
}
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at redis.clients.jedis.HostAndPort.<clinit>(HostAndPort.java:12)
at redis.clients.jedis.JedisFactory.<init>(JedisFactory.java:58)
at redis.clients.jedis.JedisFactory.<init>(JedisFactory.java:50)
at redis.clients.jedis.JedisFactory.<init>(JedisFactory.java:36)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:221)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:165)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:137)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:76)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:120)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:103)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:22)
at JedisPoolUtils.main(JedisPoolUtils.java:17)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 12 more
Jedis has slf4j-api as a compile dependency, you need to add slf4j-api jar to your application