Quarkus: Quarkus 1.3.0.Final gradle does not start with Undertow Servlet

Created on 19 Mar 2020  路  9Comments  路  Source: quarkusio/quarkus

Describe the bug
When I include Undertow Servlet in a Gradle project, quarkus application does not start.

Expected behavior
Quarkus app should start without throwing an error

Actual behavior
(Describe the actual behavior clearly and concisely.)

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://code.quarkus.io/
  2. Change Build Tool to: Gradle
  3. Add Undertow Servlet as a dependency.
  4. Generate project
  5. Try running with quarkusDev build task.

Project throws java.lang.ExceptionInInitializerError

The same configuration when used with maven starts fine.

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version:
  • GraalVM version (if different from Java):
  • Quarkus version or git rev:
  • Build tool (ie. output of mvnw --version or gradlew --version):

Additional context
(Add any other context about the problem here.)

aregradle kinbug

All 9 comments

/cc @quarkusio/devtools

I see this stacktrace, is the same you see?

2020-03-19 17:04:51,293 INFO  [org.jbo.threads] (main) JBoss Threads version 3.0.1.Final
2020-03-19 17:04:51,934 ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.ExceptionInInitializerError
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:80)
        at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:60)
        at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
        at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
        at io.quarkus.dev.DevModeMain.start(DevModeMain.java:108)
        at io.quarkus.dev.DevModeMain.main(DevModeMain.java:47)
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:400)
        ... 10 more
Caused by: java.util.ServiceConfigurationError: io.undertow.servlet.ServletExtension: io.undertow.websockets.jsr.Bootstrap not a subtype
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1236)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
        at io.undertow.servlet.core.DeploymentManagerImpl.handleExtensions(DeploymentManagerImpl.java:276)
        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:155)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:442)
        at io.quarkus.deployment.steps.UndertowBuildStep$build29.deploy_0(UndertowBuildStep$build29.zig:295)
        at io.quarkus.deployment.steps.UndertowBuildStep$build29.deploy(UndertowBuildStep$build29.zig:320)
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:386)
        ... 10 more

That definitely seems like a bug. A workaround is to add the following dependency to your build.gradle:

    implementation 'io.quarkus:quarkus-undertow-websockets'

Yes, that is the stack trace that I'm getting.

Adding the implementation 'io.quarkus:quarkus-undertow-websockets' helped, the application is now starting.

Thanks.

I can confirm this does NOT happen in Maven.

@aloubyansky any hint?

This is a Classloader issue. Quarkus Base Classloader and Quarkus Runtime Classloader (which has the former as parent).

io.undertow.websockets.jsr.Bootstrap is loaded by the child classloader

Have you tracked down what brings the websocket api in?

Ok, so it's leaking from the plugin.

Was this page helpful?
0 / 5 - 0 ratings