The default Weld SE configuration will never work with a security Manager because the JRE classes create threads were the setContextClassLoader() method always throws an exception A workaround is to use: weld.property(EXECUTOR_THREAD_POOL_TYPE.get(), ThreadPoolType.FIXED_TIMEOUT.toString()); when initializing the CDI runtime. It would be helpful if the default Weld SE configuration could detect the security manager is active and choose another thread pool type. Note: It looks like the JRE Common ForkJoinPool is restricted on a security manager enabled environment probably to avoid data leaks between different security contexts. It use what looks like internal APIs to clear all ThreadLocals, something I think it is not possible with a public API. |