Thorntail:不满足类型 LoggingFraction 与限定符 @Any 的依赖关系

Thorntail: Unsatisfied dependencies for type LoggingFraction with qualifiers @Any

我刚刚开始使用 Thorntail,我正在尝试进行最简单的测试。我编写了一个仅 returns 成功状态的 HealthCheck 实现。就这样。但是,当我 运行 mvn thorntail:run 时,我收到一条错误消息:

Unsatisfied dependencies for type LoggingFraction with qualifiers @Any

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

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.doWork(ConcurrentValidator.java:64)
    at org.jboss.weld.bootstrap.ConcurrentValidator.doWork(ConcurrentValidator.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory.call(IterativeWorkerTaskFactory.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory.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.doWork(ConcurrentValidator.java:64)
    at org.jboss.weld.bootstrap.ConcurrentValidator.doWork(ConcurrentValidator.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory.call(IterativeWorkerTaskFactory.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory.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

我没有明确包括日志部分。当我这样做时,我得到完全相同的错误。我没有做任何过于复杂的事情。这基本上只是导致此错误的美化 "Hello, World"。对我做错了什么有什么建议吗?

这很可能是 "the classpath problem"。 Thorntail 通常从 uberjar 运行,但 mvn thorntail:run 默认情况下会尝试 assemble 来自 Maven 依赖集(又名 "classpath")的类似环境。这并不总是能正常工作。您可以通过 mvn thorntail:run -Dthorntail.useUberJar 切换到 uberjar。请告诉我们这是否适合您。

旁注:我已经多次提议将默认行为切换为使用 uberjar。也许是时候这样做了:-)