Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-67

TCCL not set on requestDestroyed() invocation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Alpha18
    • 1.0.0.Alpha17
    • Servlet
    • None

      When invoking some proxy inside @PreDestroy callback of any request scoped bean you get something similar:

      WELD-000049 Unable to invoke public void org.jboss.cdi.tck.tests.context.request.jaxrs.Foo.destroy() on org.jboss.cdi.tck.tests.context.request.jaxrs.Foo@61f738ae
      	at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:91)
      	at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.preDestroy(DefaultLifecycleCallbackInvoker.java:82)
      	at org.jboss.weld.injection.producer.BasicInjectionTarget.preDestroy(BasicInjectionTarget.java:99)
      	at org.jboss.weld.injection.producer.BeanInjectionTarget.preDestroy(BeanInjectionTarget.java:73)
      	at org.jboss.weld.bean.ManagedBean.destroy(ManagedBean.java:186)
      	at org.jboss.weld.context.ForwardingContextual.destroy(ForwardingContextual.java:31)
      	at org.jboss.weld.context.AbstractContext.destroyContextualInstance(AbstractContext.java:150)
      	at org.jboss.weld.context.AbstractContext.destroy(AbstractContext.java:163)
      	at org.jboss.weld.context.AbstractManagedContext.deactivate(AbstractManagedContext.java:41)
      	at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:72)
      	at org.jboss.weld.context.http.HttpRequestContextImpl.deactivate(HttpRequestContextImpl.java:70)
      	at org.jboss.weld.servlet.WeldListener.requestDestroyed(WeldListener.java:154)
      	at io.undertow.servlet.core.ApplicationListeners.requestDestroyed(ApplicationListeners.java:176)
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:156)
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:105)
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:82)
      	at io.undertow.server.HttpHandlers.executeRootHandler(HttpHandlers.java:52)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:603)
      ...
      Caused by: java.lang.IllegalStateException: JBAS016071: Singleton not set for ModuleClassLoader for Module "org.wildfly.extension.io:main" from local module loader @4a891e7e (finder: local module finder @7031086c (roots: /opt/jboss/wildfly-weld2/modules,/opt/jboss/wildfly-weld2/modules/system/layers/base)). This means that you are trying to access a weld deployment with a Thread Context ClassLoader that is not associated with the deployment.
      	at org.jboss.as.weld.services.ModuleGroupSingletonProvider$TCCLSingleton.get(ModuleGroupSingletonProvider.java:75)
      	at org.jboss.weld.Container.instance(Container.java:54)
      	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:70)
      	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
      	at org.jboss.cdi.tck.tests.context.request.AppBean$Proxy$_$$_WeldClientProxy.getId(Unknown Source)
      

      Note that invoking proxies from within regular listeners may work from time to time, most likely because of bean instance caching (RequestScopedBeanCache)... which is not active during destruction of bean instances.

      See also TCK test:
      https://github.com/jboss/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/context/request/jaxrs/RequestContextTest.java

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              mkouba@redhat.com Martin Kouba
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: