0 Replies Latest reply on Apr 18, 2019 4:55 AM by meir meiry

    JBoss 7.1 How to load Multiple ManagedExecutorService's , getting exception on lookup

    meir meiry Newbie

      Hey
      I try ManagedExecutorService in my webapp which i diploy in JBoss 7.1 i try to load ManagedExecutorService to execute thread and to use ThreadPoll
      But im failing on lookup
      This is what i have :

       initialContext = new InitialContext(); 
      ManagedExecutorService managedExecutorService = (ManagedExecutorService) initialContext.lookup("java:comp/DefaultManagedExecutorService");
      
      
      

      Im Getting This exception:

      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)


      Then i try to set Resource as i see in some examples
      For Example :

      @Resource(name = "DefaultManagedExecutorService")
      ManagedExecutorService executor;  


      Im getting this error on load :

      Connected to server
      [2019-04-18 11:48:56,416] Artifact webapp:war: Artifact is being deployed, please wait...
      11:48:56,656 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "webapp_war.war" (runtime-name: "webapp_war.war")
      11:48:57,207 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-8) WFLYSRV0018: Deployment "deployment.webapp_war.war" is using a private module ("org.jboss.common-core") which may be changed or removed in future versions without notice.
      11:48:57,721 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-8) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.8.Final-redhat-1
      11:48:58,148 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 63) WFLYCLINF0002: Started client-mappings cache from ejb container
      11:48:58,224 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "webapp_war.war")]) - failure description: {
          "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.webapp_war.webapp_war.DefaultManagedExecutorService"],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.webapp_war.webapp_war.env.DefaultManagedExecutorService is missing [jboss.naming.context.java.module.webapp_war.webapp_war.DefaultManagedExecutorService]"]
      }
      11:48:58,226 ERROR [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0021: Deploy of deployment "webapp_war.war" was rolled back with the following failure message: 
      {
          "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.webapp_war.webapp_war.DefaultManagedExecutorService"],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.webapp_war.webapp_war.env.DefaultManagedExecutorService is missing [jboss.naming.context.java.module.webapp_war.webapp_war.DefaultManagedExecutorService]"]
      }
      11:48:58,270 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0028: Stopped deployment webapp_war.war (runtime-name: webapp_war.war) in 43ms
      
      



      Another interesting thing is if i use :
      JBossThreadFactory
      QueueExecutor
      From jboss-threads-2.2.1.Final-redhat-1.jar
      It does working , but i want to be able to be as cross container as possible and use ManagedExecutorService

      Thanks