Bootstrap$WebSocketListener throws NullPointerException in start up after updating EAP

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7.4.11+
    • 8.0.0

Issue

  • We see the following error upon start not previously seen before on prior EAP versions:
15:32:33,756 ERROR [io.undertow.servlet.request] (ServerService Thread Pool -- 78) UT015005: Error invoking method contextDestroyed on listener class io.undertow.websockets.jsr.Bootstrap$WebSocketListener: java.lang.NullPointerException
	at io.undertow.websocket@2.2.26.SP1-redhat-00001//io.undertow.websockets.jsr.Bootstrap$WebSocketListener.contextDestroyed(Bootstrap.java:133)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.ApplicationListeners.contextDestroyed(ApplicationListeners.java:202)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.DeploymentImpl.destroy(DeploymentImpl.java:291)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl$4.call(DeploymentManagerImpl.java:683)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl$4.call(DeploymentManagerImpl.java:673)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
	at io.undertow.servlet@2.2.26.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.undeploy(DeploymentManagerImpl.java:688)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
	at org.wildfly.extension.undertow@7.4.13.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.JBossThread.run(JBossThread.java:513)

Resolution

  • This NPE is caught safely and any other listeners following this are called so shouldn't have any functional impact. You may ignore this error while awaiting for later updates that clean up this error.
  • Identify the primary exception that is failing the application start up and address that.

Root Cause

*After https://github.com/wildfly/wildfly/pull/16379/ (included in 7.4.11+), EAP/Wildfly now undeploys in the event of a context start up exception. This results in contextDestroyed being call on all listeners, though not all listeners have had contextInitialized called in what progress had previously been made in start up before the error. So for Bootstrap$WebSocketListener.contextDestroyed, this means its container field is not initialized and remains null to result in an NPE after an application's start up error

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.