Skip to content

Native Picocli build breaks SSE client #36402

Description

@sdaschner

Describe the bug

When using Picocli and JAX-RS to consume SSEs, everything works well, until the app is built into a native executable.

The following exception is thrown, indicating that JAX-RS classes can't be found:

__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2023-10-11 10:25:39,671 INFO  [io.quarkus] (main) quarkus-playground-client 1.0 native (powered by Quarkus 3.2.0.Final) started in 0.009s. Listening on:
2023-10-11 10:25:39,672 INFO  [io.quarkus] (main) Profile prod activated.
2023-10-11 10:25:39,672 INFO  [io.quarkus] (main) Installed features: [cdi, picocli, rest-client, rest-client-jsonb, resteasy, resteasy-jsonb, smallrye-context-propagation, vertx]
running test run()
java.lang.RuntimeException: java.lang.ClassNotFoundException: Provider for jakarta.ws.rs.sse.SseEventSource.Builder cannot be found
	at jakarta.ws.rs.sse.SseEventSource$Builder.newBuilder(SseEventSource.java:140)
	at jakarta.ws.rs.sse.SseEventSource.target(SseEventSource.java:232)
	at com.sebastian_daschner.client.SseClient.someMethod(SseClient.java:35)
	at com.sebastian_daschner.client.SseClient_ClientProxy.someMethod(Unknown Source)
	at com.sebastian_daschner.client.TestCommand.run(TestCommand.java:26)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at io.quarkus.picocli.runtime.PicocliRunner$EventExecutionStrategy.execute(PicocliRunner.java:26)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at io.quarkus.picocli.runtime.PicocliRunner.run(PicocliRunner.java:40)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Provider for jakarta.ws.rs.sse.SseEventSource.Builder cannot be found
	at jakarta.ws.rs.sse.FactoryFinder.find(FactoryFinder.java:163)
	at jakarta.ws.rs.sse.SseEventSource$Builder.newBuilder(SseEventSource.java:125)
	... 18 more
2023-10-11 10:25:39,678 INFO  [io.quarkus] (main) quarkus-playground-client stopped in 0.002s

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

Reproducer here: https://github.com/sdaschner/quarkus-playground/tree/36402-sse-native-cli

cd server/
mvn package
java -jar target/quarkus-app/quarkus-run.jar

# different shell
cd client/
mvn package
java -jar target/quarkus-app/quarkus-run.jar --client
# works

mvn package -Dquarkus.package.type=native
target/client-runner --client
# fails with exception

Output of uname -a or ver

No response

Output of java -version

OpenJDK Runtime Environment Temurin-18.0.1+10 (build 18.0.1+10)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.4.2

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions