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
Thanks! I needed netty buffer, common and transport jars
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With