redisson classNotFoundException异常
我正在尝试使用RSET存储我的排名,但是在班级存在的同类时我有一个ClassNotFoundException(我什至分解了,课程在这里)。我认为Redisson无法存储自定义对象类? 这是我的代码:
public class RedisProvider {
private final RSet<Rank> ranks;
private final RedissonClient client;
public RedisProvider() {
this.client = Redisson.create();
this.ranks = client.getSet("ranks");
Rank rank = new Rank("default", 0, "&7", "&7");
addRank(rank);
}
public Set<Rank> getRanks(){
return ranks.readAll();
}
public void addRank(Rank rank) {
ranks.add(rank);
}
}
错误:
[17:51:39 ERROR]: Unable to decode data. channel: [id: 0xb12f3447,
L:/127.0.0.1:58768 - R:127.0.0.1/127.0.0.1:6379], reply:
ReplayingDecoderByteBuf(ridx=146, widx=146), command: (SSCAN), promise:
java.util.concurrent.CompletableFuture@4e7fd89e[Not completed, 1
dependents], params: [ranks, 0, COUNT, 10] java.io.IOException:
java.lang.ClassNotFoundException: fr.rhodless.test.Rank
我检查了“等级”类是否存在并且存在。
I'm trying to use a RSet to store my ranks, but I have a ClassNotFoundException while the class exists (I even decompiled and the class is here). In my opinion Redisson cannot store a custom object class?
Here is my code:
public class RedisProvider {
private final RSet<Rank> ranks;
private final RedissonClient client;
public RedisProvider() {
this.client = Redisson.create();
this.ranks = client.getSet("ranks");
Rank rank = new Rank("default", 0, "&7", "&7");
addRank(rank);
}
public Set<Rank> getRanks(){
return ranks.readAll();
}
public void addRank(Rank rank) {
ranks.add(rank);
}
}
Error:
[17:51:39 ERROR]: Unable to decode data. channel: [id: 0xb12f3447,
L:/127.0.0.1:58768 - R:127.0.0.1/127.0.0.1:6379], reply:
ReplayingDecoderByteBuf(ridx=146, widx=146), command: (SSCAN), promise:
java.util.concurrent.CompletableFuture@4e7fd89e[Not completed, 1
dependents], params: [ranks, 0, COUNT, 10] java.io.IOException:
java.lang.ClassNotFoundException: fr.rhodless.test.Rank
I checked if the "Rank" class existed and it exists.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以以“ bytearraycodec”/“ jsonjacksoncodec”的形式编写自己的“ org.redisson.client.codec.codec”的实现。
例如,我根据我们的需求写了一封。
You can write your own implementation of "org.redisson.client.codec.Codec" in the form of "ByteArrayCodec"/ "JsonJacksonCodec"
For example, i have written one based on our needs.