1

I am trying to develop a web application with a java back end but I need to track if the tasks are complete and I am using the ManagedExecutorService for this.

I am trying to use the @Resource annotation to inject a ManagedExecutorService as follows.

@Resource(name = "myExecutionService")
private ManagedExecutorService mExecutionService;

web.xml:

<resource-env-ref>
    <resource-env-ref-name>myExecutionService</resource-env-ref-name>
    <resource-env-ref-type>javax.enterprise.concurrent.ManagedExecutorService</resource-env-ref-type>
</resource-env-ref>

but I keep getting an error saying that I am missing the "Services with missing/unavailable dependencies"

13:52:31,207 INFO  [org.jboss.as.server] (management-handler-threads - 158) JBAS015870: Deploy of deployment "tbm-core-1.0.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"tbm-core-1.0.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"tbm-core-1.0.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [TestBedManager] with qualifiers [@Default] at injection point [[field] @Inject private com.shenick.teravm.core.ws.TestBedManagerWebService.testBedManager]"},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"tbm-core-1.0\".\"tbm-core-1.0\".env.myExecutionServicejboss.naming.context.java.jboss.resources.myExecutionServiceMissing[jboss.naming.context.java.module.\"tbm-core-1.0\".\"tbm-core-1.0\".env.myExecutionServicejboss.naming.context.java.jboss.resources.myExecutionService]"]}
4

2 回答 2

1

我已经找到了问题所在,这是因为 ManagedexecutorService 显然只是 java 7,而 jboss 7.1.1 不会部署使用线程的应用程序。

为了解决这个问题,我需要升级到 EAP 6.1(jboss 的新名称)。

于 2013-10-23T15:25:11.060 回答
0

如果您只想使用默认实现,请使用

@Resource(mappedName="java:comp/DefaultManagedExecutorService")

在这种情况下,您不需要在 web.xml 中指定它。

如果您想使用自己的实现,我认为您应该首先配置您的应用程序服务器资源(使用您的实现进行设置)。

编辑:

我偶然发现了这个: 如何在 Wildfly 中配置计划任务。我想它可以帮助你。

于 2013-10-23T13:48:50.103 回答