vert-x3 / vertx-examples

Vert.x examples
Apache License 2.0
3.55k stars 2.09k forks source link

NPE in vertx-redis-client 4.3.0 #437

Closed xiaojianhx closed 2 years ago

xiaojianhx commented 2 years ago

There is an exception: Exception in thread "main" java.lang.NullPointerException: Cannot invoke "io.vertx.core.impl.ContextInternal.nettyEventLoop()" because "this.context" is null

jdk version:17 vertx-redis-client version: 4.3.0

    public static void main(String[] args) {

        var vertx = Vertx.vertx();
        api = RedisAPI.api(Redis.createClient(vertx, "redis://:abracadabra@localhost:6379/1"));
        api.incr("a").onSuccess(r -> {
            System.out.println(r);
        });
    }

In vertx-redis-client version: 4.2.7, it can run。How to use in 4.3.0?

pmlopes commented 2 years ago

This was fixed on master. To workaround it run the code inside a vert.x context