Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError for multi-module dependency in Vert.x reactive routes when using Maven quarkusDev #15204

Closed
wjtan opened this issue Feb 19, 2021 · 1 comment · Fixed by #15795
Labels
area/maven env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@wjtan
Copy link

wjtan commented Feb 19, 2021

Describe the bug
A multi-module maven project contains two submodules mod1 and mod2, where mod2 depends on mod1.
When running mod2 in dev mode, NoClassDefFoundError occurs for a route class from mod1.

The error does not occur when the application is built with mvn package and run with java -jar mod2/target/mod2-0.0.1-SNAPSHOT-runner.jar.

Expected behavior
The application should work no matter if it is run in dev mode or not.

Actual behavior
If the application is started with mvn compile quarkus:dev -pl mod2, an internal server error is returned when a request is made to a route in mod1. Both the log and the HTTP response contain a stacktrace:

2021-02-20 02:39:39,613 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-3) HTTP Request to /mod1/ failed, error id: d2ed3e7e-337e-4fcf-9c6e-eddc7944cecc-1: java.lang.NoClassDefFoundError: sg/wjtan/mod1/IndexPage
        at sg.wjtan.mod1.IndexPage_RouteHandler_index_279c3f7d45b3461bf7246354cb951cebf8120d77.invoke(IndexPage_RouteHandler_index_279c3f7d45b3461bf7246354cb951cebf8120d77.zig:104)
        at io.quarkus.vertx.web.runtime.RouteHandler.handle(RouteHandler.java:97)
        at io.quarkus.vertx.web.runtime.RouteHandler.handle(RouteHandler.java:22)
        at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
        at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:101)
        at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
        at io.quarkus.vertx.http.runtime.VertxHttpRecorder$17.handle(VertxHttpRecorder.java:1121)
        at io.quarkus.vertx.http.runtime.VertxHttpRecorder$17.handle(VertxHttpRecorder.java:1092)
        at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
        at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
        at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
        at io.quarkus.vertx.http.runtime.VertxHttpRecorder$4.handle(VertxHttpRecorder.java:333)
        at io.quarkus.vertx.http.runtime.VertxHttpRecorder$4.handle(VertxHttpRecorder.java:311)
        at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
        at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
        at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
        at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$3.handle(VertxHttpHotReplacementSetup.java:86)
        at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$3.handle(VertxHttpHotReplacementSetup.java:75)
        at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:327)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
        at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: sg.wjtan.mod1.IndexPage
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:428)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:378)
        ... 28 more

To Reproduce

Steps to reproduce the behavior:

  1. Fetch to sample project from https://github.com/wjtan/quarkus-multi-web
  2. Compile the project mvn install
  3. Start the application using mvn compile quarkus:dev -pl mod2
  4. Open the URL http://localhost:8080/mod1

Environment (please complete the following information):

  • Output of uname -a or ver: Windows 10 20H2
  • Output of java -version: java 11.0.10 2021-01-19 LTS
  • GraalVM version (if different from Java): n/a
  • Quarkus version or git rev: 1.12.0.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): Maven 3.6.3
@wjtan wjtan added the kind/bug Something isn't working label Feb 19, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 19, 2021

/cc @quarkusio/devtools

@quarkus-bot quarkus-bot bot added area/maven env/windows Impacts Windows machines labels Feb 19, 2021
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Mar 17, 2021
@quarkus-bot quarkus-bot bot added this to the 1.13 - main milestone Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maven env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant