运行种子堆栈应用程序时出现异常



我使用了Hibernate和JPA的seedstack依赖项来创建DAO服务,这些服务在数据库上执行crud操作。 我正在尝试通过 SeedMain 类在 Eclipse 中的 Java 应用程序启动器启动此 Seedstack 应用程序模块。

In pom.xml  - dependecy for undertow is given.
<dependency>
<groupId>org.seedstack.seed</groupId>
<artifactId>seed-web-undertow</artifactId>
</dependency>
When executing the SeedMain class, I am getting the below error snakeyaml error:-
Exception in thread "main" java.lang.NoSuchMethodError: org.yaml.snakeyaml.DumperOptions.setSplitLines(Z)V
at com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.buildDumperOptions(YAMLGenerator.java:259)
at com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.<init>(YAMLGenerator.java:232)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createGenerator(YAMLFactory.java:447)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:397)
at org.seedstack.seed.core.internal.diagnostic.DefaultDiagnosticReporter.writeDiagnosticReport(DefaultDiagnosticReporter.java:75)
at org.seedstack.seed.core.internal.diagnostic.DefaultDiagnosticReporter.writeDiagnosticReport(DefaultDiagnosticReporter.java:67)
at org.seedstack.seed.core.internal.diagnostic.DiagnosticManagerImpl.dumpDiagnosticReport(DiagnosticManagerImpl.java:70)
at org.seedstack.seed.core.SeedMain.handleException(SeedMain.java:68)
at org.seedstack.seed.core.SeedMain.main(SeedMain.java:61)

根据我的理解,该错误是由于snakeyaml的某些版本不一致造成的,但对于 Seedstack 来说,因为依赖项的版本是由 seedstack-bom 依赖项解决的,所以我应该在哪里进行更改来解决错误。

提前感谢!

从读取堆栈跟踪来看,似乎您在启动时遇到了一些错误,该错误由handleException()方法处理。然后,此方法尝试编写 YAML 诊断报告,但由于您提到的 snakeyaml 版本问题,最终失败。

您应该做两件事:

  • 通过查看依赖关系树来修复 snakeyaml 依赖项问题。这种问题通常是由某些库引起的,这些库使Maven选择旧版本。SeedStack 至少需要jackson-dataformat-yaml2.9.4 版本,而 2.9.4 版本又至少需要 1.18snakeyaml
  • 通过查看完整的堆栈跟踪来修复另一个错误。当无法写入诊断报告时,原始异常仍打印在控制台上(在 stderr 上)。

相关内容

最新更新