gpt4 book ai didi

java - 获取 java.lang.NoSuchFieldError : WRITE_BUFFER_HIGH_WATER_MARK exception when connectig Redis server

转载 作者:行者123 更新时间:2023-12-02 03:59:51 25 4
gpt4 key购买 nike

连接 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();
}

}

最佳答案

由于不同版本的 Netty 依赖项,您遇到了冲突。 Lettuce 5.1.7 实际上依赖于 netty 4.1.36,因此您应该使用 netty-all 4.1.36 而不是 4.0.0。

关于java - 获取 java.lang.NoSuchFieldError : WRITE_BUFFER_HIGH_WATER_MARK exception when connectig Redis server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56739505/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com