RedisBloom / JRedisBloom

Java Client for RedisBloom probabilistic module
https://redisbloom.io
BSD 2-Clause "Simplified" License
153 stars 33 forks source link

what is the version of jedis ? #11

Closed zhiqiangren closed 3 years ago

zhiqiangren commented 5 years ago

In the Client class, i get that you import redis.clients.jedis.util.Pool;but my project occour this Exception:java.lang.ClassNotFoundException: redis.clients.jedis.util.Pool;I am sure it's the version of jedis(2.9.0) in my project cause this problem .So,what is your version of jedis? Thx.

zhiqiangren commented 5 years ago

up,up,up...

joyang1 commented 5 years ago

version is 3.0.0;

        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>3.0.0</version>
        </dependency>
joyang1 commented 5 years ago

If you use JRebloom client, you can remove the jedis client in you project. @zhiqiangren

zhiqiangren commented 5 years ago

yes! I remove the jedis dependency,import the jrebloom denpendency.and in my main method,my code like this: Client client = new Client("localhost", 6379); then there is a problem:Exception in thread "main" java.lang.NoClassDefFoundError: redis/clients/jedis/util/Pool,i can not find the reason... @joyang1

joyang1 commented 5 years ago

Can you let me look at your pom.xml?

zhiqiangren commented 5 years ago

here it is pom.zip

zhiqiangren commented 5 years ago

@joyang1

joyang1 commented 5 years ago

I think you can use

<dependency>
  <groupId>com.redislabs</groupId>
  <artifactId>jrebloom</artifactId>
  <version>2.0.0-m2</version>
</dependency>

this.

Then mvn clean you project. Then mvn package. try it.

zhiqiangren commented 5 years ago

it is te same problem.And i find a problem,I import jrebloom,no matter the version is 1.2.0 or 2.0.0-m2, the jedis version always is 2.9.0...so occure this problem :redis/clients/jedis/util/Pool...,the jedis version can not be 3.0.0? @joyang1

joyang1 commented 5 years ago

You can let

<dependency>
  <groupId>com.redislabs</groupId>
  <artifactId>jrebloom</artifactId>
  <version>2.0.0-m2</version>
</dependency>

on the top of maven dependency in the pom.

zhiqiangren commented 5 years ago

@joyang1 ,I am sorry, I let the dependency on the top of maven dependency in the pom.But I failed. The same problem.The jedis version.is also 2.9.0....

zhiqiangren commented 5 years ago

@joyang1 Hi,我直接中文描述我的问题吧。我的操作步骤如下: 1、新建了一个springboot project; 2、引入jrebloom依赖,放在dependencies的最前面; 3、在src/main/java包下,新建测试类,写了一个main函数,函数中调用Client,如下 Client client = new Client("localhost", 6379); client.add("simpleBloom", "Mark"); System.out.println(client.exists("simpleBloom", "Mark")); client.exists("simpleBloom", "Farnsworth"); 第一行就报错...... 1、我分析原因是jedis的版本不匹配。jreblom引入的是2.9.0版本的jedis,但是这个版本中并没有redis/clients/jedis/util/Pool,因而报错。 2、但是我的另一个解决思路是,jrebloom依赖引入的jedis是2.9.0版本。。。我排除了jrelboom依赖中对jedis的依赖,单独引入jedis3.0.0版本,结果可以了。。。所以,我得出结论,jrebloom中对jedis依赖的版本有误吧。。。 另,我现在redis的版本是3.x,出现ERR unknown command 'BF.ADD',不过上面的问题已经解决!thx!

joyang1 commented 5 years ago

image 不可能会出现你说的情况的,从 1.1.0 的版本开始,jedis 就是 3.x 的版本了,所以问题还是出在你那边。我们这边都有 UnitTest,所以应该没问题的。

还有 BF.ADD 命令是针对 redisbloom,不是 redis,你需要自己在 redis 里面加载模块(redisbloom.so)。 redisbloom.so 的编译和加载到 redis 的具体步骤请参考RedisBloom

zhiqiangren commented 5 years ago

@joyang1 OK ,let me try again! Thangk you very much!

c5p0 commented 4 years ago

如果redis 有密码的,可以自定义jedispool连接,提供的client 可以传递jedispool Client client = new Client(jedisPool);

joyang1 commented 4 years ago

@c5p0 , what are you meaning?

lovedworking commented 4 years ago

上述问题解决了吗?redis带密码的话,我试了试传递redispool不行的啊

zhiqiangren commented 4 years ago

没有解决呢,你也遇到类似的问题了么? @lovedworking

lovedworking commented 4 years ago

没有解决呢,你也遇到类似的问题了么? @lovedworking

换了jedis 3.0解决问题了 打扰了

lovedworking commented 4 years ago

没有解决呢,你也遇到类似的问题了么? @lovedworking

我试了下可以的,

redis.clients jedis 3.0.0 com.redislabs jrebloom 2.0.0-m2

用这两个依赖可以了 开始我的jedis是2.9.0