我尝试在JBoss webapp中使用Use ManagedExecutorService
initialContext = new InitialContext();
ManagedExecutorService managedExecutorService = (ManagedExecutorService) initialContext.lookup("java:comp/DefaultManagedExecutorService");
但在尝试查找时出现此异常
11:12:12,445 ERROR [stderr] (default task-4) javax.naming.NameNotFoundException: DefaultManagedExecutorService -- service jboss.naming.context.java.module.webapp_war.webapp_war.DefaultManagedExecutorService
11:12:12,446 ERROR [stderr] (default task-4) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
11:12:12,447 ERROR [stderr] (default task-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
11:12:12,448 ERROR [stderr] (default task-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
11:12:12,448 ERROR [stderr] (default task-4) at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:239)
11:12:12,449 ERROR [stderr] (default task-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
11:12:12,450 ERROR [stderr] (default task-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
11:12:12,450 ERROR [stderr] (default task-4) at javax.naming.InitialContext.lookup(InitialContext.java:417)
11:12:12,451 ERROR [stderr] (default task-4) at javax.naming.InitialContext.lookup(InitialContext.java:417)
11:12:12,451 ERROR [stderr] (default task-4) at MainServlet.doGet(MainServlet.java:42)
11:12:12,451 ERROR [stderr] (default task-4) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
11:12:12,452 ERROR [stderr] (default task-4) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
11:12:12,452 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
11:12:12,452 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
11:12:12,453 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
11:12:12,453 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
11:12:12,453 ERROR [stderr] (default task-4) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:12,454 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
11:12:12,454 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
11:12:12,454 ERROR [stderr] (default task-4) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:12,454 ERROR [stderr] (default task-4) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
11:12:12,455 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
11:12:12,455 ERROR [stderr] (default task-4) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
11:12:12,455 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
11:12:12,456 ERROR [stderr] (default task-4) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
11:12:12,456 ERROR [stderr] (default task-4) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
11:12:12,457 ERROR [stderr] (default task-4) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:12,457 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
11:12:12,457 ERROR [stderr] (default task-4) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:12,458 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
11:12:12,458 ERROR [stderr] (default task-4) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
11:12:12,458 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
11:12:12,459 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
11:12:12,459 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
11:12:12,460 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
11:12:12,460 ERROR [stderr] (default task-4) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
11:12:12,460 ERROR [stderr] (default task-4) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
11:12:12,461 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
11:12:12,461 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
11:12:12,462 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
11:12:12,462 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
11:12:12,462 ERROR [stderr] (default task-4) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
11:12:12,462 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
11:12:12,462 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
11:12:12,463 ERROR [stderr] (default task-4) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
11:12:12,463 ERROR [stderr] (default task-4) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:326)
11:12:12,464 ERROR [stderr] (default task-4) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
11:12:12,464 ERROR [stderr] (default task-4) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
11:12:12,465 ERROR [stderr] (default task-4) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
11:12:12,466 ERROR [stderr] (default task-4) at java.lang.Thread.run(Thread.java:745)