https://bz.apache.org/bugzilla/show_bug.cgi?id=64503
--- Comment #4 from Michael Seele <mse...@guh-software.de> --- Thanks for the answer, Mark. Just for the record, here is how I solved it: I created a new helper method that acts like a wrapper for the mapping function: public static <T, R> Function<T, R> parallel(Function<T, R> function) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); return input -> { Thread thread = Thread.currentThread(); ClassLoader originalTccl = thread.getContextClassLoader(); try { thread.setContextClassLoader(tccl); return function.apply(input); } finally { thread.setContextClassLoader(originalTccl); } }; } The method is used this way and solves the problem: List<String> values = keys.parallelStream().map(parallel(key -> { try { return (String) InitialContext.doLookup(DEFAULT_CONTEXT + key); } catch (NamingException e) { throw new RuntimeException("Error on lookup", e); //$NON-NLS-1$ } })).collect(Collectors.toList()); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org