vert-x3 / vertx-examples

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

NoClassDefFoundError for Vertx verticle with docker image #339

Open yaniv51 opened 5 years ago

yaniv51 commented 5 years ago

Hi all, We are using Vertx docker image for our vertx web application server (written in Java) from the example below: https://github.com/vert-x3/vertx-examples/blob/master/docker-examples/vertx-docker-java/Dockerfile

After adding vertx Thymeleaf template engine, we found that on run time(on production), there is an exception: java.lang.NoClassDefFoundError: org/attoparser/IMarkupParser while trying to render HTML file with Thymeleaf, although the .CLASS files was found inside the fat JAR file.

After a small research, we found that our application is missing current jar CLASSPATH. For fixing it, we just added the current JAR file to CLASSPATH environment variable: ENV CLASSPATH "$VERTICLE_HOME/$VERTICLE_JAR"

tsegismont commented 5 years ago

So you're building a jar with dependencies, correct? Then have you checked the vertx-docker-java-fatjar example?