Reputation: 401
I am trying to learn how to use the Managed Executor service on wildfy 11, but when I deploy my application I get the following errors:
10:28:34,185 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "crowbar-server.war")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.crowbar-server.crowbar-server.env.jboss.ee.concurrency.executor.default"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.crowbar-server.crowbar-server.env.\"com.ticomgeo.crowbar.server.ejb.ManagedExecutorExample\".mes is missing [jboss.naming.context.java.module.crowbar-server.crowbar-server.env.jboss.ee.concurrency.executor.default]"]
}
I apologize in advance if this is a dumb question, but I am brand new to wildfly and JEE.
The executor is defined in the standalone.xml. (I had to remove the angle brackets or it would not display, not sure how to escape XML)
subsystem xmlns="urn:jboss:domain:ee:4.0"
spec-descriptor-property-replacement>false</spec-descriptor-property-replacement
concurrent
context-services
context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/
/context-services
managed-thread-factories
managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/
/managed-thread-factories
managed-executor-services
managed-executor-service
name="default"
jndi-name="java:jboss/ee/concurrency/executor/default"
context-service="default"
hung-task-threshold="60000"
keepalive-time="5000"/>
/managed-executor-services
managed-scheduled-executor-services
managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" keepalive-time="3000"/
/managed-scheduled-executor-services
/concurrent
The code that references it is very simple
package com.ticomgeo.crowbar.server.ejb;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.enterprise.concurrent.ManagedExecutorService;
@Singleton(name = "ManagedExecutorExample")
public class ManagedExecutorExample {
@Resource(lookup = "jboss/ee/concurrency/executor/default")
private ManagedExecutorService mes;
public void testMe(int secsToSleep){
mes.submit(new TestClass());
System.out.println("Submitted test class");
}
private class TestClass implements Runnable{
public void run(){
System.out.println("Running runable");
try {
Thread.sleep(10000);
}catch(Exception e){
}
System.out.println("Done Sleeping");
}
}
Upvotes: 0
Views: 1208
Reputation: 12865
Please try using the full JNDI name:
@Resource(lookup = "java:jboss/ee/concurrency/executor/default")
private ManagedExecutorService mes;
Or just leave it out to get the default resource:
@Resource
private ManagedExecutorService mes;
Upvotes: 3