При подключении к серверу redis я получаю исключение java.lang.NoSuchFieldError: WRITE_BUFFER_HIGH_WATER_MARK
. Я удалил фактические данные о хосте и порте в коде.
Exception in thread "main" java.lang.NoSuchFieldError: WRITE_BUFFER_HIGH_WATER_MARK
at io.lettuce.core.AbstractRedisClient.connectionBuilder(AbstractRedisClient.java:148)
at io.lettuce.core.RedisClient.connectStatefulAsync(RedisClient.java:303)
at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:271)
at io.lettuce.core.RedisClient.connect(RedisClient.java:204)
at io.lettuce.core.RedisClient.connect(RedisClient.java:189)
at testpack.RedisClientTest.setCacheIntoRedis(RedisClientTest.java:30)
at testpack.RedisClientTest.main(RedisClientTest.java:24)
Код:
public class RedisClientTest {
/**
* @param args
*/
public static void main(String[] args) {
setCacheIntoRedis("TestKey", "Hello Redis");
}
public static void setCacheIntoRedis(String key, String value) {
// Removed actual server details
RedisClient redisClient = RedisClient.create("redis://redis123@host:port/0");
StatefulRedisConnection<String, String> connection = redisClient.connect();
RedisCommands<String, String> syncCommands = connection.sync();
syncCommands.set(key, value);
connection.close();
redisClient.shutdown();
}
}