简体   繁体   English

sbt 无法以 NoClassDefFoundError 启动

[英]sbt failed to start with NoClassDefFoundError

On a remote Windows 10 system sbt failes to start with a NoClassDefFoundError :在远程 Windows 10 系统上, sbt无法以NoClassDefFoundError启动:

C:\WORKBENCH\BPF\my-project>sbt -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT -Dsbt.boot.credentials="C:\WORKBENCH\BPF\my-project\credentials.txt" -Dsbt.boot.directory=C:\WORKBENCH\BPF\.sbt\boot -Dsbt.coursier.home=C:\WORKBENCH\BPF\coursier -v
# Executing command line:
"C:\Program Files (x86)\Java\jre1.8.0_321\bin\java.exe"
-Djavax.net.ssl.trustStore="C:\Program Files (x86)\Java\jre1.8.0_321\lib\security\cacerts"
-Djavax.net.ssl.trustStorePassword=changeit
-Xms1024m
-Xmx1024m
-Xss4M
-XX:ReservedCodeCacheSize=128m
-cp
"C:\Program Files (x86)\sbt\bin\sbt-launch.jar"
xsbt.boot.Boot
-Djavax.net.ssl.trustStoreType=WINDOWS-ROOT
-Dsbt.boot.credentials=C:\WORKBENCH\BPF\my-project\credentials.txt
-Dsbt.boot.directory=C:\WORKBENCH\BPF\.sbt\boot
-Dsbt.coursier.home=C:\WORKBENCH\BPF\coursier
 
java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to xsbti.FullReload
       at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:59)
        at sbt.xMain.run(Main.scala:46)
        at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
        at xsbt.boot.Launch$.run(Launch.scala:149)
        at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
        at xsbt.boot.Launch$.launch(Launch.scala:159)
        at xsbt.boot.Launch$.apply(Launch.scala:44)
        at xsbt.boot.Launch$.apply(Launch.scala:21)
        at xsbt.boot.Boot$.runImpl(Boot.scala:78)
        at xsbt.boot.Boot$.run(Boot.scala:73)
        at xsbt.boot.Boot$.main(Boot.scala:21)
        at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to xsbti.FullReload
  • Tried with different SBT versions (1.6.2, 1.5.8, 1.4.9) by changing project/build.properties ): The Stack Trace differs depending on the version, but it is always a NoClassDefFoundError .通过更改project/build.properties尝试使用不同的 SBT 版本(1.6.2、1.5.8、1.4.9):堆栈跟踪因版本而异,但始终是NoClassDefFoundError
  • The SBT version specified in the project is successfully downloaded by the launcher.启动器成功下载项目中指定的SBT版本。

I suspect local file permission problems as cause (eg due to security policies) therefore i moved the boot and the coursier cache directory.我怀疑本地文件权限问题是原因(例如由于安全策略),因此我移动了引导和 coursier 缓存目录。 However, this did not bring the desired success.然而,这并没有带来预期的成功。

Does anyone have an idea what the Problem could be?有谁知道问题可能是什么?

(I did not do much findings about it.) In my case i could fix it by changing to appropriate java version. (我没有做太多的发现。)在我的情况下,我可以通过更改为适当的 java 版本来修复它。 Initially i ran with java 18v mistakenly and then changing to java 11v it worked.最初我错误地使用 java 18v 运行,然后更改为 java 11v 它工作。

我没有真正的诊断或因果解释,但我确实通过清除 sbt 缓存(用户目录中的.sbt文件夹)解决了类似的问题(相同的错误消息,Linux)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM