Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SBT 1.5.0: java.lang.NoClassDefFoundError: scala/tools/nsc/reporters/FilteringReporter #35

Closed
tovbinm opened this issue Apr 6, 2021 · 13 comments

Comments

@tovbinm
Copy link

tovbinm commented Apr 6, 2021

Hello,

We just upgraded to sbt 1.5.0 and got the following error:

Exception in thread "sbt-parser-init-thread" java.lang.NoClassDefFoundError: scala/tools/nsc/reporters/FilteringReporter
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at sbt.internal.parser.SbtParser$.<init>(SbtParser.scala:138)
	at sbt.internal.parser.SbtParser$.<clinit>(SbtParser.scala)
	at sbt.internal.parser.SbtParserInit$$anon$2.run(SbtParser.scala:191)
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.reporters.FilteringReporter
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 13 more
[info] welcome to sbt 1.5.0 (GraalVM Community Java 11.0.9)
java.lang.NoClassDefFoundError: Could not initialize class sbt.internal.parser.SbtParser$
	at sbt.internal.parser.SbtParser.splitExpressions(SbtParser.scala:247)
	at sbt.internal.parser.SbtParser.<init>(SbtParser.scala:236)
	at sbt.internal.EvaluateConfigurations$.splitExpressions(EvaluateConfigurations.scala:289)
	at sbt.internal.EvaluateConfigurations$.parseConfiguration(EvaluateConfigurations.scala:98)
	at sbt.internal.EvaluateConfigurations$.evaluateSbtFile(EvaluateConfigurations.scala:147)
	at sbt.internal.Load$.loadSettingsFile$1(Load.scala:1107)
	at sbt.internal.Load$.$anonfun$discoverProjects$2(Load.scala:1117)
	at scala.collection.MapLike.getOrElse(MapLike.scala:131)
	at scala.collection.MapLike.getOrElse$(MapLike.scala:129)
	at scala.collection.AbstractMap.getOrElse(Map.scala:65)
	at sbt.internal.Load$.memoLoadSettingsFile$1(Load.scala:1116)
	at sbt.internal.Load$.$anonfun$discoverProjects$4(Load.scala:1124)
	at scala.collection.immutable.List.map(List.scala:293)
	at sbt.State$StateOpsImpl$.runCmd$1(State.scala:289)
	at sbt.State$StateOpsImpl$.process$extension(State.scala:325)
	at sbt.MainLoop$.$anonfun$next$4(MainLoop.scala:163)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
	at sbt.MainLoop$.next(MainLoop.scala:163)
	at sbt.MainLoop$.run(MainLoop.scala:144)
	at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:119)
	at sbt.io.Using.apply(Using.scala:27)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:112)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:66)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:51)
	at sbt.MainLoop$.runLogged(MainLoop.scala:42)
	at sbt.StandardMain$.runManaged(Main.scala:192)
	at sbt.xMain$.$anonfun$run$8(Main.scala:101)
	at sbt.internal.util.Terminal$.withStreams(Terminal.scala:381)
	at sbt.xMain$.run(Main.scala:86)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:56)
	at sbt.xMain.run(Main.scala:46)
	at coursier.sbtlauncher.LauncherApp$.$anonfun$doRun$4(LauncherApp.scala:263)
	at scala.util.Either.fold(Either.scala:191)
	at coursier.sbtlauncher.LauncherApp$.doRun(LauncherApp.scala:263)
	at coursier.sbtlauncher.LauncherApp$.run(LauncherApp.scala:445)
	at coursier.sbtlauncher.LauncherApp$.run(LauncherApp.scala:16)
	at caseapp.core.app.CaseApp.main(CaseApp.scala:82)
	at coursier.sbtlauncher.MainApp$.main(MainApp.scala:81)
	at coursier.sbtlauncher.MainApp.main(MainApp.scala)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at coursier.bootstrap.launcher.a.a(Unknown Source)
	at coursier.bootstrap.launcher.Launcher.main(Unknown Source)

Are there any recommendations on how to overcome this issue?

@tovbinm tovbinm changed the title Sbt 1.5.0 SBT 1.5.0: java.lang.NoClassDefFoundError: scala/tools/nsc/reporters/FilteringReporter Apr 6, 2021
@SethTisue
Copy link
Contributor

presumably an out of date sbt launch script

@olafurpg
Copy link
Owner

olafurpg commented Apr 6, 2021

The script is sbt-extras, which is installed like this

https://github.com/olafurpg/setup-scala/blob/05b368ddd620abc33fd3412cb2b33b54868a78b5/src/install.ts#L109

It's probably worth changing that to use cs install sbt instead 🤔

@SethTisue
Copy link
Contributor

SethTisue commented Apr 6, 2021

I don't trust cs install sbt. I'm optimistic it will eventually be suitable, but IMO it currently isn't, as per coursier/coursier#1957, coursier/coursier#1696, coursier/coursier#1755, coursier/coursier#1867

@laughedelic
Copy link

Also coursier/sbt-runner#6.

@olafurpg
Copy link
Owner

olafurpg commented Apr 6, 2021

What is the recommended alternative to sbt-extras?

@SethTisue
Copy link
Contributor

What is the recommended alternative to sbt-extras?

the sbt launch script published by the sbt maintainers and included in the sbt downloads

@SethTisue
Copy link
Contributor

@eed3si9n the recommended way to obtain that is by extracting it from e.g. https://github.com/sbt/sbt/releases/download/v1.5.0/sbt-1.5.0.tgz , yes?

(I think sometimes people go for sbt-extras just because you can easily grab the launch script by itself)

@laughedelic
Copy link

laughedelic commented Apr 6, 2021

By the way, official sbt launcher is preinstalled in GHA runners, at least on linux and windows, not sure why not on macos.

@eed3si9n
Copy link

eed3si9n commented Apr 6, 2021

@SethTisue I think so, or SDKMAN distribution, which we garden.

I've been actually thinking the official should have an option to work in one-file Bash script way.

@liufengyun
Copy link

I also ran into this problem, re-install solves the problem:

cs uninstall sbt
cs install sbt

@Miuler
Copy link

Miuler commented May 6, 2021

I also ran into this problem, re-install solves the problem:

cs uninstall sbt
cs install sbt

Esto funciono para mi.
This worked for me.

@SethTisue
Copy link
Contributor

I've been actually thinking the official should have an option to work in one-file Bash script way.

Note that Eugene has now done this; the official launch script is available from e.g. https://raw.githubusercontent.com/sbt/sbt/v1.5.2/sbt

@olafurpg
Copy link
Owner

Thank you for reporting! Closing this since it's not clear how to address this issue in this project. Please reopen if I'm misunderstanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants