-
Bug
-
Resolution: Done
-
Major
-
2.2.0.ER1, 2.2.1.ER1
-
False
-
False
-
+
-
Undertow Websockets: Could not create an endpoint dynamically
-
-
This issue comes from upstream
Extensions: io.quarkus:quarkus-undertow-websockets
On version 1.11.7.Final I could create an endpoint dynamically as follow:
((ServerContainer) sce.getServletContext().getAttribute(ServerContainer.class.getName())) .addEndpoint(ServerEndpointConfig.Builder.create(WebsockEndpoint.class, "/simple").configurator(new WebsockEndpointConfigurator(this)).build());
However after upgrade to version 1.13.7.Final I got a NullPointerException
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:528) at io.quarkus.deployment.steps.UndertowBuildStep$build-649634386.deploy_0(UndertowBuildStep$build-649634386.zig:238) at io.quarkus.deployment.steps.UndertowBuildStep$build-649634386.deploy(UndertowBuildStep$build-649634386.zig:40) at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:169) ... 43 more Caused by: java.lang.RuntimeException: java.lang.NullPointerException at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:253) at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:517) ... 46 more Caused by: java.lang.NullPointerException at io.quarkus.qe.undertow.PongLeakSample.contextInitialized(PongLeakSample.java:51)
If instead of creating the endpoint as we described above we do by this way:
ServerContainer container = (ServerContainer) ContainerProvider.getWebSocketContainer(); container.addEndpoint(ServerEndpointConfig.Builder.create(WebsockEndpoint.class, "/simple").configurator(new WebsockEndpointConfigurator(this)).build());
Then the nullpointer exception is not thrown but the endpoint is not created.