Thorntail:带有限定符@Any

时间:2019-05-13 20:37:56

标签: java exception java-ee cdi thorntail

我刚开始使用Thorntail,并且正在尝试进行最简单的测试。我已经编写了一个HealthCheck实现,该实现只返回成功状态。就这样。但是,当我运行mvn thorntail:run时,出现错误消息:

  

带限定符@Any的LoggingFraction类型的依赖关系未满足

这是堆栈跟踪的相关部分:

2019-05-13 16:33:28,475 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."holocron-data-services-0.1-SNAPSHOT.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."holocron-data-services-0.1-SNAPSHOT.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1730)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 2 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type LoggingFraction with qualifiers @Any
  at injection point [BackedAnnotatedField] @Inject @Any private org.wildfly.swarm.logging.runtime.LoggingCustomizer.fraction
  at org.wildfly.swarm.logging.runtime.LoggingCustomizer.fraction(LoggingCustomizer.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:290)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:143)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:526)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:64)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Exception 1 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type LoggingFraction with qualifiers @Any
  at injection point [BackedAnnotatedField] @Inject @Any private org.wildfly.swarm.logging.runtime.EarlyLoggingCustomizer.fraction
  at org.wildfly.swarm.logging.runtime.EarlyLoggingCustomizer.fraction(EarlyLoggingCustomizer.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:290)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:143)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:526)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:64)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:485)

    at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:72)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:487)
    at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:490)
    at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
    at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:98)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1738)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1700)
    ... 6 more
    Suppressed: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type LoggingFraction with qualifiers @Any
  at injection point [BackedAnnotatedField] @Inject @Any private org.wildfly.swarm.logging.runtime.LoggingCustomizer.fraction

我没有明确包括Logging分数。当我这样做时,我会得到完全相同的错误。我没有做任何过于复杂的事情。基本上,这只是引起此错误的美化“ Hello,World”。关于我做错了什么建议吗?

1 个答案:

答案 0 :(得分:1)

这很可能是“类路径问题”。 Thorntail通常是从uberjar运行的,但是默认情况下mvn thorntail:run试图从Maven依赖集(也称为“ classpath”)中组装一个类似的环境。这并不总是能正常工作。您可以通过mvn thorntail:run -Dthorntail.useUberJar切换到uberjar。请让我们知道是否适合您。

侧面说明:我已经多次提出将默认行为切换为使用uberjar的建议。也许终于该了:-)