我在Windows 7上运行Tomcat 8.5进行测试,不能使用ManagedExecutorService。 通过资源注入和代码尝试:
ManagedExecutorService executorService = (ManagedExecutorService)
ctx.lookup("java:comp/DefaultManagedExecutorService");
ManagedExecutorService executorService = (ManagedExecutorService)
ctx.lookup("java:comp/env/concurrent/ThreadPool");
两人都得到了:
javax.servlet.ServletException:javax.naming.NameNotFoundException:名称[concurrent / ThreadPool]未绑定在此Context中。无法找到[并发]。
使用默认安装程序安装Tomcat。 Tomcat conf files