JBoss Wildfly中与EJB的依赖关系错误 [英] Wrong dependencies with EJB in JBoss Wildfly

查看:172
本文介绍了JBoss Wildfly中与EJB的依赖关系错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个TimerHelper类,该类可以从其他类接收Callable并尝试执行它们。如果发生异常,它将等待一段时间,然后重试。因此,其他类可以导出必须完成的任务,但目前尚不完全。

i wrote a TimerHelper class which can receive Callables from other classes and tries to execute them. If an exception occurs, it waits some time and tries again. So other classes can export tasks that have to be done, but not exactly at the moment.

@Startup
@Singleton
public class TimerHelper{
private static final Logger LOGGER = Logger.getLogger(TimerHelper.class.getName());

private Callable<Void> task;
private int failureCounter = 0;

public TimerHelper(){

}

@Resource
private ManagedExecutorService executorService;
@Resource
private TimerService timerService;

public void setNewTimer(Callable<Void> task){
this.task = task;

timerService.createIntervalTimer(0, 5000, new TimerConfig());
}

@Timeout
public void timerMethod(Timer timer) {
    if(failureCounter <10){

        try{
            Future<Void> future = executorService.submit(task);
            future.get();       
            LOGGER.log(Level.INFO, "Did something");
            failureCounter =0;
            timer.cancel();
            }catch(Exception e){
                failureCounter++;
                LOGGER.log(Level.WARNING, "Errored while doing something, will try again");
            }

    }else{
        timer.cancel();
        LOGGER.log(Level.SEVERE, "Tried to add something to Database several times, but failed. Please check the OpenRDF-Database");

    }


}

}

此TimerHelper类在API包中,许多其他包在其POM.xml中具有依赖项。
一切正常,除了一个模块 Usermanagement。
当我尝试将其部署到Wildfly 9时,我总是得到此异常:

This TimerHelper-class is in a API package to which a lot of other packages have a dependency in their POM.xml. Everything works fine except for one module "Usermanagement". I get allways this Exception when i try to deploy it to Wildfly 9:


14:56:19,125错误[org。 jboss.msc.service.fail](MSC服务线程1-7)MSC000001:无法启动服务jboss.deployment.unit。 usermanagement.war。PARSE:服务jboss.deployment中的org.jboss.msc.service.StartException。 .unit。 usermanagement.war .PARSE:WFLYSRV0153:无法在org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)上处理部署 usermanagement.war
的阶段PARSE。 org.jboss.msc.service.ServiceControllerImpl $ StartTask.startService(ServiceControllerImpl.java:1948)的
org.jboss.msc.service.ServiceControllerImpl $ StartTask.run(ServiceControllerImpl.java:1881)的

在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
在Java .lang.Thread.run (线程.java:745)
,由以下原因引起:java.lang.IllegalArgumentException:WFLYEE0040:此模块
中的org.jboss.as.ee.component.EEModuleDescription已定义了名为 TimerHelper的组件。 .addComponent(EEModuleDescription.java:162)在org.jboss.as.ejb3.deployment.processors.EJBComponentDescriptionFactory.addComponent(EJBComponentDescriptionFactory.java:58)
在org.jboss.as.ejb3.deployment .processors.SessionBeanComponentDescriptionFactory.processSessionBeans(SessionBeanComponentDescriptionFactory.java:169)
在org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processAnnotations(SessionBeanComponentDescriptionFactory.java:98)在org.jboss.as处
.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java:57)
at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy( org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
... 5 more

14:56:19,125 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."usermanagement.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."usermanagement.war".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment "usermanagement.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalArgumentException: WFLYEE0040: A component named 'TimerHelper' is already defined in this module at org.jboss.as.ee.component.EEModuleDescription.addComponent(EEModuleDescription.java:162) at org.jboss.as.ejb3.deployment.processors.EJBComponentDescriptionFactory.addComponent(EJBComponentDescriptionFactory.java:58) at org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processSessionBeans(SessionBeanComponentDescriptionFactory.java:169) at org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processAnnotations(SessionBeanComponentDescriptionFactory.java:98) at org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java:57) at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy(AbstractDeploymentUnitProcessor.java:81) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156) ... 5 more

14:56:19,126错误[org.jboss.as.controller.management-operation](management-handler-thread-38)WFLYCTL0013:操作( deploy)失败-地址:([( deployment => usermanagement.war)]))-失败描述:{ WFLYCTL0080:失败的服务 => { jboss.deployment.unit.\ usermanagement.war\ .PARSE => org.jboss服务jboss.deployment.unit.\ usermanagement.war\中的.msc.service.StartException。PARSE:WFLYSRV0153:无法处理部署阶段SESESE usermanagement.war\
由:java.lang.IllegalArgumentException:WFLYEE0040:此模块中已经定义了名为 TimerHelper的组件。}}
14:56:19,126错误[org.jboss.as.server](管理处理程序线程- 38)WFLYSRV0021:部署 usermanagement.war的部署已通过以下方式回滚失败消息:
{ WFLYCTL0080:失败的服务 => { jboss.deployment.unit.\ usermanagement.war\ .PARSE => org.jboss.msc.service.StartException在service jboss.deployment.unit.\ usermanagement.war\。PARSE:WFLYSRV0153:无法处理部署阶段PARSE \ usermanagement.war\
原因:java.lang.IllegalArgumentException: WFLYEE0040:此模块中已经定义了名为 TimerHelper的组件。}

14:56:19,126 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 38) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "usermanagement.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"usermanagement.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"usermanagement.war\".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment \"usermanagement.war\" Caused by: java.lang.IllegalArgumentException: WFLYEE0040: A component named 'TimerHelper' is already defined in this module"}} 14:56:19,126 ERROR [org.jboss.as.server] (management-handler-thread - 38) WFLYSRV0021: Deploy of deployment "usermanagement.war" was rolled back with the following failure message: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"usermanagement.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"usermanagement.war\".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment \"usermanagement.war\" Caused by: java.lang.IllegalArgumentException: WFLYEE0040: A component named 'TimerHelper' is already defined in this module"}}

我很确定这是因为 @Singleton注解,但我不知道如何解决此问题。
也许还因为用户管理对 api和 aaa具有依赖性,而 aaa也对 api具有依赖性?!

I'm pretty sure it's because of the "@Singleton" annotation, but i can't figure out how to solve this problem. Maybe its also because usermanagement has a dependency to "api" and "aaa", and "aaa" also have a dependency to "api" ?!

推荐答案

您解决了吗?就我而言,似乎对服务器进行清理有助于
(在日食中,单击服务器上的右键并按 clean),然后选择完全发布。

Did you solve this? In my case it seems that doing a server cleanup helped (in eclipse, right button on the server and push "clean") then choose a Full Publish.

欢呼
Nekos

Cheers Nekos

这篇关于JBoss Wildfly中与EJB的依赖关系错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆