quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.83k stars 2.7k forks source link

Application does not start after update from 3.15.2 to 3.16.3 due to open api processor #44577

Closed msts1906 closed 2 days ago

msts1906 commented 2 days ago

Describe the bug

Beginning with any Quarkus 3.16 version, the application does not start due to something in the OpenApi processor. Everything works perfectly fine in 3.15 and older.

The class with the OpenAPI Config looks as follows: `package com.example;

import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition; import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType; import org.eclipse.microprofile.openapi.annotations.info.Info; import org.eclipse.microprofile.openapi.annotations.security.*;

@ApplicationPath("/api") @OpenAPIDefinition( info = @Info( title = "Service", version = "1.0.0", description = "The service provides endpoints for managing resources."), security = {@SecurityRequirement(name = "oauth")}) @SecurityScheme( securitySchemeName = "oauth", type = SecuritySchemeType.OAUTH2, openIdConnectUrl = "https://example.com/auth/realms/example/.well-known/openid-configuration", flows = @OAuthFlows( clientCredentials = @OAuthFlow( scopes = {@OAuthScope(name = "oauth")}, authorizationUrl = "https://example.com/auth/realms/example", tokenUrl = "https://example.com/auth/realms/example/protocol/openid-connect/token", refreshUrl = "https://example.com/auth/realms/example/protocol/openid-connect/token"))) public class ServiceApp extends Application {}`

On start up I get the following error log:

2024-11-19 16:24:20,668 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor#build threw an exception: java.lang.NullPointerException at java.base/java.util.HashMap.merge(HashMap.java:1363) at java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1636) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:73) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:58) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:47) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:53) at io.smallrye.openapi.runtime.io.security.OAuthFlowIO.read(OAuthFlowIO.java:38) at io.smallrye.openapi.runtime.io.security.OAuthFlowIO.read(OAuthFlowIO.java:15) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.ModelIO.read(ModelIO.java:142) at io.smallrye.openapi.runtime.io.security.OAuthFlowsIO.read(OAuthFlowsIO.java:37) at io.smallrye.openapi.runtime.io.security.OAuthFlowsIO.read(OAuthFlowsIO.java:15) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.ModelIO.read(ModelIO.java:142) at io.smallrye.openapi.runtime.io.security.SecuritySchemeIO.read(SecuritySchemeIO.java:55) at io.smallrye.openapi.runtime.io.security.SecuritySchemeIO.read(SecuritySchemeIO.java:17) at io.smallrye.openapi.runtime.io.MapModelIO.read(MapModelIO.java:35) at io.smallrye.openapi.runtime.io.MapModelIO.lambda$readMap$0(MapModelIO.java:70) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.MapModelIO.lambda$readMap$1(MapModelIO.java:70) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:73) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:58) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:39) at io.smallrye.openapi.runtime.io.security.SecurityIO.readSchemes(SecurityIO.java:56) at io.smallrye.openapi.runtime.scanner.spi.AnnotationScanner.processSecuritySchemeAnnotation(AnnotationScanner.java:142) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.processApplicationClass(JaxRsAnnotationScanner.java:202) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.processApplicationClasses(JaxRsAnnotationScanner.java:172) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.scan(JaxRsAnnotationScanner.java:148) at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.scan(OpenApiAnnotationScanner.java:232) at io.smallrye.openapi.api.SmallRyeOpenAPI$Builder.buildAnnotationModel(SmallRyeOpenAPI.java:588) at io.smallrye.openapi.api.SmallRyeOpenAPI$Builder.build(SmallRyeOpenAPI.java:680) at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.build(SmallRyeOpenApiProcessor.java:874) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499)

    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:354)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:272)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:62)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:89)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:428)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
    at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
    at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
    at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
    at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)

Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor#build threw an exception: java.lang.NullPointerException at java.base/java.util.HashMap.merge(HashMap.java:1363) at java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1636) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:73) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:58) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:47) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:53) at io.smallrye.openapi.runtime.io.security.OAuthFlowIO.read(OAuthFlowIO.java:38) at io.smallrye.openapi.runtime.io.security.OAuthFlowIO.read(OAuthFlowIO.java:15) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.ioO.read(ModelIO.java:142) at io.smallrye.openapi.runtime.io.security.OAuthFlowsIO.read(OAuthFlowsIO.java:37) at io.smallrye.openapi.runtime.io.security.OAuthFlowsIO.read(OAuthFlowsIO.java:15) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.ModelIO.read(ModelIO.java:142) at io.smallrye.openapi.runtime.io.security.SecuritySchemeIO.read(SecuritySchemeIO.java:55) at io.smallrye.openapi.runtime.io.security.SecuritySchemeIO.read(SecuritySchemeIO.java:17) at io.smallrye.openapi.runtime.io.MapModelIO.read(MapModelIO.java:35) at io.smallrye.openapi.runtime.io.MapModelIO.lambda$readMap$0(MapModelIO.java:70) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.MapModelIO.lambda$readMap$1(MapModelIO.java:70) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:73) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:58) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:39) at io.smallrye.openapi.runtime.io.security.SecurityIO.readSchemes(SecurityIO.java:56) at io.smallrye.openapi.runtime.scanner.spi.AnnotationScanner.processSecuritySchemeAnnotation(AnnotationScanner.java:142) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.processApplicationClass(JaxRsAnnotationScanner.java:202) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.processApplicationClasses(JaxRsAnnotationScanner.java:172) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.scan(JaxRsAnnotationScanner.java:148) at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.scan(OpenApiAnnotationScanner.java:232) at io.smallrye.openapi.api.SmallRyeOpenAPI$Builder.buildAnnotationModel(SmallRyeOpenAPI.java:588) at io.smallrye.openapi.api.SmallRyeOpenAPI$Builder.build(SmallRyeOpenAPI.java:680) at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.build(SmallRyeOpenApiProcessor.java:874) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499)

    at io.quarkus.builder.Execution.run(Execution.java:124)
    at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
    at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:350)
    ... 9 more

Caused by: java.lang.NullPointerException at java.base/java.util.HashMap.merge(HashMap.java:1363) at java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1636) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:73) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:58) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:47) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:53) at io.smallrye.openapi.runtime.io.security.OAuthFlowIO.read(OAuthFlowIO.java:38) at io.smallrye.openapi.runtime.io.security.OAuthFlowIO.read(OAuthFlowIO.java:15) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.ModelIO.read(ModelIO.java:142) at io.smallrye.openapi.runtime.io.security.OAuthFlowsIO.read(OAuthFlowsIO.java:37) at io.smallrye.openapi.runtime.io.security.OAuthFlowsIO.read(OAuthFlowsIO.java:15) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.ModelIO.read(ModelIO.java:142) at io.smallrye.openapi.runtime.io.security.SecuritySchemeIO.read(SecuritySchemeIO.java:55) at io.smallrye.openapi.runtime.io.security.SecuritySchemeIO.read(SecuritySchemeIO.java:17) at io.smallrye.openapi.runtime.io.MapModelIO.read(MapModelIO.java:35) at io.smallrye.openapi.runtime.io.MapModelIO.lambda$readMap$0(MapModelIO.java:70) at java.base/java.util.Optional.map(Optional.java:260) at io.smallrye.openapi.runtime.io.MapModelIO.lambda$readMap$1(MapModelIO.java:70) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:73) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:58) at io.smallrye.openapi.runtime.io.MapModelIO.readMap(MapModelIO.java:39) at io.smallrye.openapi.runtime.io.security.SecurityIO.readSchemes(SecurityIO.java:56) at io.smallrye.openapi.runtime.scanner.spi.AnnotationScanner.processSecuritySchemeAnnotation(AnnotationScanner.java:142) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.processApplicationClass(JaxRsAnnotationScanner.java:202) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.processApplicationClasses(JaxRsAnnotationScanner.java:172) at io.smallrye.openapi.jaxrs.JaxRsAnnotationScanner.scan(JaxRsAnnotationScanner.java:148) at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.scan(OpenApiAnnotationScanner.java:232) at io.smallrye.openapi.api.SmallRyeOpenAPI$Builder.buildAnnotationModel(SmallRyeOpenAPI.java:588) at io.smallrye.openapi.api.SmallRyeOpenAPI$Builder.build(SmallRyeOpenAPI.java:680) at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.build(SmallRyeOpenApiProcessor.java:874) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueE$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499)

Expected behavior

Application starts, or at least gives a descriptive message of what went wrong

Actual behavior

The application does not start

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

openjdk version "21" 2023-09-19 OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15) OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)

Quarkus version or git rev

No response

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

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) Maven home: /Users/U714771/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8 Java version: 21, vendor: GraalVM Community, runtime: /Users/U714771/.sdkman/candidates/java/21-graalce Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "15.1", arch: "aarch64", family: "mac"

Additional information

No response

gsmet commented 2 days ago

Could you try to come up with a small Maven project reproducing the issue?

quarkus-bot[bot] commented 2 days ago

/cc @EricWittmann (openapi), @MikeEdgar (openapi), @phillip-kruger (openapi)

MikeEdgar commented 2 days ago

To work around it, you can try adding a description to the scope anotation:

@OAuthScope(name = "oauth", description = "some description")

It may already be fixed in newer versions of smallrye-open-api.

gsmet commented 2 days ago

@msts1906 It would help if you could try with 3.17.0.CR1 to see if the next Quarkus version will fix it.

msts1906 commented 2 days ago

@msts1906 It would help if you could try with 3.17.0.CR1 to see if the next Quarkus version will fix it.

That does indeed fix the issue

msts1906 commented 2 days ago

To work around it, you can try adding a description to the scope anotation:

@OAuthScope(name = "oauth", description = "some description")

It may already be fixed in newer versions of smallrye-open-api.

That fixes the issue too on 3.16.3

I assume something was off with the defaults?

gsmet commented 2 days ago

Given there is an easy workaround and we have a fix in 3.17.0 that will be released next week, I will mark this one as closed.

Thanks for the report and for checking!