Buggy code:
public final class ViewService implements Service < ComponentView > { private final InjectedValue < Component > componentInjector = new InjectedValue < Component > ( ) ; private final Map < Method , InterceptorFactory > viewInterceptorFactories ; private final Map < Method , InterceptorFactory > clientInterceptorFactories ; private final InterceptorFactory clientPostConstruct ; private final InterceptorFactory clientPreDestroy ; private final ProxyFactory < ? > proxyFactory ; private final Class < ? > viewClass ; private final Set < Method > asyncMethods ; private final ViewInstanceFactory viewInstanceFactory ; private final Map < Class < ? > , Object > privateData ; private volatile ComponentView view ; private volatile Interceptor clientPostConstructInterceptor ; private volatile Interceptor clientPreDestroyInterceptor ; private volatile Map < Method , Interceptor > clientInterceptors ; public ViewService ( final ViewConfiguration viewConfiguration ) { } public void start ( final StartContext context ) throws StartException { } public void stop ( final StopContext context ) { } public Injector < Component > getComponentInjector ( ) { } public ComponentView getValue ( ) throws IllegalArgumentException , IllegalStateException { } class View implements ComponentView { private final Component component ; private final Map < Method , Interceptor > viewInterceptors ; private final Map < ViewService . View . MethodDescription , Method > methods ; private final Map < Class < ? > , Object > privateData ; View ( final Map < Class < ? > , Object > privateData ) { } void initializeInterceptors ( ) { } public ManagedReference createInstance ( ) throws Exception { } public ManagedReference createInstance ( Map < Object , Object > contextData ) throws Exception { final ClassLoader oldTCCL = WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ; try { <START_BUG> WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( component . getComponentClass ( ) . getClassLoader ( ) ) ; <END_BUG> return viewInstanceFactory . createViewInstance ( this , contextData ) ; } finally { WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( oldTCCL ) ; } } @ Override public Object invoke ( InterceptorContext interceptorContext ) throws Exception { } public Component getComponent ( ) { } @ Override public Class < ? > getProxyClass ( ) { } @ Override public Class < ? > getViewClass ( ) { } @ Override public Set < Method > getViewMethods ( ) { } @ Override public Method getMethod ( final String name , final String descriptor ) { } @ Override public < T > T getPrivateData ( final Class < T > clazz ) { } @ Override public boolean isAsynchronous ( final Method method ) { } @ Override public String toString ( ) { } private final class MethodDescription { private final String name ; private final String descriptor ; public MethodDescription ( final String name , final String descriptor ) { } @ Override public boolean equals ( final Object o ) { } @ Override public int hashCode ( ) { } } } private class DefaultViewInstanceFactory implements ViewInstanceFactory { public ManagedReference createViewInstance ( final ComponentView componentView , final Map < Object , Object > contextData ) throws Exception { } } }

Fix:
WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( component . getComponentClass ( ) ) ;