Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2676

"WELD-001303: No active contexts..." when MyFaces/JSF calls CDI/Weld on HTTP session cleanup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • None
    • None
    • Hide

      As said in the description, it seems to be an issue that can also be reproduced easily on tomcat with a standard webapp (WAR file) as well; i have not done this yet, but can if needed.

      Show
      git clone https://github.com/38leinaD/jetty-issue-reproducer-cleanup-session.git ./gradlew run (With JDK 8) Open http://localhost:8080/index.xhtml Close browser again Wait ~ 1 minute and you should see the exception (i have set session-timeout to 1 minute and also SessionHouseKeeper Interval to 10 seconds) As said in the description, it seems to be an issue that can also be reproduced easily on tomcat with a standard webapp (WAR file) as well; i have not done this yet, but can if needed.
    • Undefined

      We see below exception when Jetty cleans expired HTTP sessions:

      2021-07-06 22:32:30,016 WARN  [org.eclipse.jetty.server.session] (Session-HouseKeeper-4f4e375c-1): org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped
      	at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:647)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:89)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:164)
      	at org.jboss.weld.bean.ContextualInstance.getIfExists(ContextualInstance.java:63)
      	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:87)
      	at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:131)
      	at org.apache.myfaces.cdi.view.ViewScopeBeanHolder$Proxy$_$$_WeldClientProxy.destroyBeans(Unknown Source)
      	at org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:113)
      	at org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:201)
      	at org.eclipse.jetty.server.session.SessionHandler$2.run(SessionHandler.java:312)
      	at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1520)
      	at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1539)
      	at org.eclipse.jetty.server.session.SessionContext.run(SessionContext.java:92)
      	at org.eclipse.jetty.server.session.SessionHandler.callSessionDestroyedListeners(SessionHandler.java:316)
      	at org.eclipse.jetty.server.session.SessionHandler.invalidate(SessionHandler.java:1216)
      	at org.eclipse.jetty.server.session.DefaultSessionIdManager.expireAll(DefaultSessionIdManager.java:436)
      	at org.eclipse.jetty.server.session.SessionHandler.scavenge(SessionHandler.java:1267)
      	at org.eclipse.jetty.server.session.HouseKeeper.scavenge(HouseKeeper.java:250)
      	at org.eclipse.jetty.server.session.HouseKeeper$Runner.run(HouseKeeper.java:62)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      

      First analysis was already done by the Jetty guys: https://github.com/eclipse/jetty.project/issues/6506

      I am facing the issue on jetty together with MyFaces 2.3.8 and Weld 3.1.5.Final. The jetty maintainers where able to reproduce this issue also on tomcat. So, it seems to be no issue with these specific version but maybe a general mismatch between weld and myfaces and the suggestion was to create an issue here and on myfaces to continue the discussion.

              Unassigned Unassigned
              38leinad Daniel Platz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: