Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vertx NoClassDefFoundError: io/netty/channel/EventLoopGroup

Tags:

vert.x

this is probably a stupid question, but which jar needs to be referenced besides vertx-core jar in order to run a simple verticle example. I have code like this:

package examples.vertx;
import io.vertx.core.Vertx;  
public class VertxApp {

    public static void main(String[] args) {

        Vertx vertx = Vertx.vertx();

        vertx.deployVerticle(new MyVerticle("name1"), stringAsyncResult -> {
            System.out.println("MyVerticle deployed");
        });
    }
}

and

package examples.vertx; 
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;   
public class MyVerticle extends AbstractVerticle {

    private String name = null;

    public MyVerticle(String name) {
        this.name = name;
    }

    @Override
    public void start(Future<Void> startFuture) {
        System.out.println("MyVerticle started!");

        vertx.eventBus().consumer("test", message -> {
            System.out.println(this.name + " received message: " + message.body());
        });
    }

    @Override
    public void stop(Future stopFuture) throws Exception {
        System.out.println("MyVerticle stopped!");
    }
}

and searched through the vertx documentation but can't see which jar I ought to be referencing besides vertx-core jar. When I run the code I get the error:

Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup
    at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:34)
    at io.vertx.core.Vertx.vertx(Vertx.java:78)
    at examples.vertx.VertxApp.main(VertxApp.java:9)
Caused by: java.lang.ClassNotFoundException: io.netty.channel.EventLoopGroup
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 3 more
like image 256
rupweb Avatar asked Sep 01 '15 10:09

rupweb


1 Answers

Thanks! I needed netty buffer, common and transport jars

refs

like image 96
rupweb Avatar answered Sep 30 '22 05:09

rupweb