I must migrate an existing application, running on Wildfly Swarm (2018) to Thorntail. Yes, I know this is outdated already, but ... I did it with another application, without problems. But now I get an deployment error:
2021-10-07 13:59:04,226 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Thorntail 2.5.0.Final (WildFly Core 7.0.0.Final) started in 3109ms - Started 150 of 155 services (31 services are lazy, passive or on-demand)
2021-10-07 14:02:35,651 ERROR [stderr] (main) org.wildfly.swarm.container.DeploymentException: java.lang.NullPointerException
2021-10-07 14:02:35,652 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:301)
2021-10-07 14:02:35,652 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:174)
2021-10-07 14:02:35,652 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:107)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer$Proxy$_$$_WeldClientProxy.deploy(Unknown Source)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:476)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:747)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2021-10-07 14:02:35,653 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Unknown Source)
2021-10-07 14:02:35,654 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:57)
2021-10-07 14:02:35,654 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:134)
2021-10-07 14:02:35,654 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:87)
2021-10-07 14:02:35,654 ERROR [stderr] (main) Caused by: java.lang.NullPointerException
2021-10-07 14:02:35,655 ERROR [stderr] (main) at io.smallrye.openapi.runtime.util.TypeUtil.getAnnotation(TypeUtil.java:281)
2021-10-07 14:02:35,655 ERROR [stderr] (main) at io.smallrye.openapi.runtime.util.TypeUtil.getSchemaAnnotation(TypeUtil.java:236)
2021-10-07 14:02:35,655 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.readKlass(OpenApiDataObjectScanner.java:236)
2021-10-07 14:02:35,655 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.depthFirstGraphSearch(OpenApiDataObjectScanner.java:206)
2021-10-07 14:02:35,655 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.process(OpenApiDataObjectScanner.java:190)
2021-10-07 14:02:35,655 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiDataObjectScanner.process(OpenApiDataObjectScanner.java:141)
2021-10-07 14:02:35,656 ERROR [stderr] (main) at io.smallrye.openapi.runtime.util.SchemaFactory.introspectClassToSchema(SchemaFactory.java:242)
2021-10-07 14:02:35,656 ERROR [stderr] (main) at io.smallrye.openapi.runtime.util.SchemaFactory.typeToSchema(SchemaFactory.java:214)
2021-10-07 14:02:35,656 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.processJaxRsMethod(OpenApiAnnotationScanner.java:645)
2021-10-07 14:02:35,656 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.processJaxRsResourceClass(OpenApiAnnotationScanner.java:373)
2021-10-07 14:02:35,656 ERROR [stderr] (main) at io.smallrye.openapi.runtime.scanner.OpenApiAnnotationScanner.scan(OpenApiAnnotationScanner.java:207)
2021-10-07 14:02:35,656 ERROR [stderr] (main) at io.smallrye.openapi.runtime.OpenApiProcessor.modelFromAnnotations(OpenApiProcessor.java:72)
2021-10-07 14:02:35,657 ERROR [stderr] (main) at org.wildfly.swarm.microprofile.openapi.runtime.OpenApiDeploymentProcessor.process(OpenApiDeploymentProcessor.java:101)
2021-10-07 14:02:35,657 ERROR [stderr] (main) at org.wildfly.swarm.microprofile.openapi.runtime.OpenApiDeploymentProcessor$Proxy$_$$_WeldClientProxy.process(Unknown Source)
2021-10-07 14:02:35,657 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:233)
2021-10-07 14:02:35,657 ERROR [stderr] (main) ... 12 more
Debugging into the code at startup, I see that there is a NPE when parsing annotations of the Endpoint. The difference to my other application is, that the Payload uses Polymorphism:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "eventType")
@JsonSubTypes({
@JsonSubTypes.Type(value = PayloadDocument.class, name = "document"),
@JsonSubTypes.Type(value = PayloadCampaign.class, name = "campaign"),
@JsonSubTypes.Type(value = PayloadMessage.class, name = "message")
})
public void setPayload(Payload payload) {
this.payload = payload;
}
The class Payload is abstract.
CodePudding user response:
I solved the issue, without switching to Quarkus (what I will definitely do in the next step). The problem was, that I used an Optional attribute in my Payload PoJo. I found it by digging a little deeper in the debugger. After eliminating the Optional attribute, the deployment worked as expected.