Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19495

EAP XP: Smallrye OpenAPI throws java.lang.NullPointerException with deployment containing Java Generics

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • None
    • EAP-XP-1.0.0.GA-CR1
    • MP OpenAPI
    • None
    • Hide

      Start EAP XP (e.g. jboss-eap-xp-1.0.0.GA-CR1.zip) with standalone-microprofile.xml:

      ./bin/standalone.sh --server-config=standalone-microprofile.xml
      

      Then deploy the attached app.war (or the war obtained from the repro-generics-no-inheritance.zip maven project attached)

      Show
      Start EAP XP (e.g. jboss-eap-xp-1.0.0.GA-CR1.zip ) with standalone-microprofile.xml : ./bin/standalone.sh --server-config=standalone-microprofile.xml Then deploy the attached app.war (or the war obtained from the repro-generics-no-inheritance.zip maven project attached)

      Smallrye OpenAPI throws a java.lang.NullPointerException when a war file is deployed which contains JAX-RS endpoint using Java Generics:

      16:33:35,141 INFO  [org.jboss.as.repository] (DeploymentScanner-threads - 1) WFLYDR0001: Content added at location /home/tborgato/projects/RFE/RESTEASY-2581/jboss-eap-xp-1.0.0.GA-CR1/jboss-eap-7.3/standalone/data/content/ab/bce9eb772019eb9722068b26bed10a92d40d2f/content
      16:33:35,164 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "app.war" (runtime-name: "app.war")
      16:33:36,385 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service org.wildfly.undertow.host.default-server.default-host./openapi: org.jboss.msc.service.StartException in service org.wildfly.undertow.host.default-server.default-host./openapi: java.lang.NullPointerException
      	at org.wildfly.clustering.service@7.3.1.GA-redhat-00001//org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:70)
      	at org.jboss.msc@1.4.11.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
      	at org.jboss.msc@1.4.11.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
      	at org.jboss.msc@1.4.11.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
      	at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      	at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.NullPointerException
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.util.TypeUtil.isTerminalType(TypeUtil.java:396)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.dataobject.TypeProcessor.resolveTypeVariable(TypeProcessor.java:239)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.dataobject.TypeProcessor.resolveParameterizedType(TypeProcessor.java:214)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.dataobject.TypeProcessor.readParameterizedType(TypeProcessor.java:180)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.dataobject.TypeProcessor.processType(TypeProcessor.java:133)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.dataobject.AnnotationTargetProcessor.processField(AnnotationTargetProcessor.java:151)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.dataobject.AnnotationTargetProcessor.process(AnnotationTargetProcessor.java:89)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.preProcessSpecial(OpenApiDataObjectScanner.java:274)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.resolveSpecial(OpenApiDataObjectScanner.java:270)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.process(OpenApiDataObjectScanner.java:208)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.process(OpenApiDataObjectScanner.java:163)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.util.SchemaFactory.typeToSchema(SchemaFactory.java:360)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.createResponseFromJaxRsMethod(OpenApiAnnotationScanner.java:924)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.processJaxRsMethod(OpenApiAnnotationScanner.java:688)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.lambda$processJaxRsResourceClass$0(OpenApiAnnotationScanner.java:422)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
      	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
      	at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.processJaxRsResourceClass(OpenApiAnnotationScanner.java:420)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.scan(OpenApiAnnotationScanner.java:221)
      	at io.smallrye.openapi//io.smallrye.openapi.runtime.OpenApiProcessor.modelFromAnnotations(OpenApiProcessor.java:72)
      	at org.wildfly.extension.microprofile.openapi-smallrye@7.3.1.GA-redhat-00001//org.wildfly.extension.microprofile.openapi.deployment.OpenAPIModelServiceConfigurator.get(OpenAPIModelServiceConfigurator.java:173)
      	at org.wildfly.extension.microprofile.openapi-smallrye@7.3.1.GA-redhat-00001//org.wildfly.extension.microprofile.openapi.deployment.OpenAPIModelServiceConfigurator.get(OpenAPIModelServiceConfigurator.java:94)
      	at org.wildfly.clustering.service@7.3.1.GA-redhat-00001//org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:67)
      	... 8 more
      

      The error was originally spotted running AnnotationInheritanceGenericsTest in the Resteasy test-suite with jboss-eap-xp-1.0.0.GA-CR1.zip.

      We attached 3 sample maven projects:

      • repro-generics: contains JAX-RS endpoints that contain generics and inheritance and you hit the java.lang.NullPointerException when you deploy it
      • repro-generics-no-inheritance: contains JAX-RS endpoints that contain generics (no inheritance) and you hit the java.lang.NullPointerException when you deploy it; this proves the problem is related to generics and not to the combination generics + inheritance (this was done because the AnnotationInheritanceGenericsTest test contains this combination)
      • repro-no-generics: contains the same JAX-RS endpoints as the first one but with no generics and you don't hit the error

      One workaround would be disabling OpenAPI from the application like described in Admin_Guide:

      in /META-INF/microprofile-config.properties:
      
      mp.openapi.extensions.enabled=false
      

      Another workaround would be disabling OpenAPI at the server level:

      $ ./bin/jboss-cli.sh 
      [disconnected /] embed-server --server-config=standalone-microprofile.xml
      [standalone@embedded /] /subsystem=microprofile-openapi-smallrye:remove()
      

      Smallrye OpenAPI throws java.lang.NullPointerException in different cases. The first one which was reported is when a war file is deployed which contains JAX-RS endpoint using Java Generics but please see recent comments and relevant information in the "Steps to Reproduce" field in order to get latest details.

        1. app.war
          8 kB
        2. repro-no-generics.zip
          9 kB
        3. repro-generics.zip
          9 kB
        4. repro-generics-no-inheritance.zip
          9 kB

              pferraro@redhat.com Paul Ferraro
              tborgato@redhat.com Tommaso Borgato
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: