"UT015005: Error invoking method requestDestroyed on listener class com.sun.faces.config.ConfigureListener: java.lang.UnsupportedOperationException" is occasionally logged for JSF application in JBoss EAP 7.x
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
Issue
The following exception is logged in server.log. What caused this exception?
ERROR [io.undertow.servlet.request] (default task-1) UT015005: Error invoking method requestDestroyed on listener class com.sun.faces.config.ConfigureListener: java.lang.UnsupportedOperationException
at javax.faces.context.FacesContext.getExceptionHandler(FacesContext.java:280)
at javax.faces.event.ExceptionQueuedEventContext.getListenersForEventClass(ExceptionQueuedEventContext.java:248)
at com.sun.faces.application.applicationimpl.Events.invokeComponentListenersFor(Events.java:181)
at com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:106)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:119)
at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:776)
at com.sun.faces.application.WebappLifecycleListener.requestDestroyed(WebappLifecycleListener.java:149)
at com.sun.faces.config.ConfigureListener.requestDestroyed(ConfigureListener.java:385)
at io.undertow.servlet.core.ApplicationListeners.requestDestroyed(ApplicationListeners.java:289)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:330)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1555)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:395)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:889)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1348)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.lang.Thread.run(Thread.java:750)
Resolution
This UnsupportedOperationException is thrown when any exception happens inside Content from github.com is not included.com.sun.faces.application.WebappLifecycleListener#requestDestroyed() of JSF implementation (mojarra).
A possible cause might be an exception (IllegalStateException) which is thrown at HttpSession.setAttibute() operation in mojarra's listener because of session invalidation (or expiration). However, as JSF implementation (mojarra) swallows an original exception, it's not possible to identify the root cause from the current log. This content is not included.JBEAP-28797 has been raised to improve logging in mojarra.
If the issue is reproducible, you can log the original exception and output log when session is initialized and invalidated by using byteman debug rule like the following. Also refer to this article for details about using byteman.
RULE Debug_log_exception_at_new_ExceptionQueuedEventContext_from_requestDestroyed
CLASS javax.faces.event.ExceptionQueuedEventContext
METHOD <init>(javax.faces.context.FacesContext, java.lang.Throwable)
AT ENTRY
IF callerEquals("com.sun.faces.application.WebappLifecycleListener.requestDestroyed", true, true) && $2 != null
DO $2.printStackTrace();
ENDRULE
RULE Debug_session_init
INTERFACE javax.servlet.http.HttpSession
METHOD <init>
AT EXIT
IF TRUE
DO traceStack("---------------------------> HttpSession is initiallized. session id = " + $0.getId() + "\n");
ENDRULE
RULE Debug_session_invalidate
INTERFACE javax.servlet.http.HttpSession
METHOD invalidate
AT EXIT
IF TRUE
DO traceStack("---------------------------> HttpSession is invalidated. session id = " + $0.getId() + "\n");
ENDRULE
Root Cause
- As an original exception is swallowed, we do not know what exception happened. This content is not included.JBEAP-28797 has been raised to improve logging in mojarra and the original exception should be logged since JBoss EAP 7.4.23+.
- A possible suspectable exception might be IllegatlStateException thrown Content from github.com is not included.at seession.setAttribute call for ViewScoped Session because the session might be expired or invalidated just before here. So, an original exception might not be related to JSF. And, as per This content is not included.JBEAP-26003 (and This content is not included.JBEAP-26002 / This content is not included.WFLY-18708), EAP 7.4.17+ (and EAP 8.0.3+) disables these redundunt session.setAttribute()‘ operation by default. So, if this guess is correct, the original exception might not happen in the newer versions of JBoss EAP 7.4.17+ and 8.0.3+.
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.