sbt fails with java.lang.NoClassDefFoundError: scala/Serializable

See original GitHub issue

steps

On a Mac OSX 10.14.6, I run

$ brew install openjdk
$ brew install sbt
$ sbt sbtVersion

problem

This is the output:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
java.lang.NoClassDefFoundError: scala/Serializable
	at sbt.internal.ClassLoaderWarmup$.warmup(XMainConfiguration.scala:31)
	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:567)
	at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:82)
	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)
Caused by: java.lang.ClassNotFoundException: scala.Serializable
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 18 more
[error] [launcher] error during sbt launcher: java.lang.NoClassDefFoundError: scala/Serializable

expectation

I was hoping for something like

sbt version 1.5.4

notes

Is it some CLASSPATH issue?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
eed3si9ncommented, Jul 10, 2021

I think I know what’s happening.

I messed up util-interface during 1.4.x and accidentally added Scala dependency to it. For sbt 1.4.0, 1.4.1, and 1.4.2, Scala 2.13 is added. If you use sbt 1.4.3 and onwards, it should be ok.

0reactions
eed3si9ncommented, Jul 11, 2021

Great. I added a workaround to launcher, so hopefully launcher 1.5.5 will be able to launch sbt 1.4.0 as well, even though staying on the latest is usually recommended.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scala SBT - Java ClassNotFoundException when running ...
SBT crashes on pattern matching and say nothing. SBT bug? 11 · NoClassDefFoundError using Scala class from Java · 0 · java.lang.
Read more >
java.lang.NoClassDefFoundError: scala/Serializable - Question
1 and now we can't seem to run the code as the run is aborted due to this error message. An exception or...
Read more >
Error during sbt execution: java.lang.NoClassDefFoundError
i was using sbt-0.4 to build project a project called "dispatch" and got the following exception: java.lang.NoClassDefFoundError: scala/Option at java.lang.
Read more >
ClassNotFoundException when running with sbt and Scala ...
I had an issue when running a Spark 1.0 app locally with sbt. The issue was that if you both: 1. Reference a...
Read more >
JetBrains/intellij-scala - Gitter
I can't get past this error Internal error: java.lang.NoClassDefFoundError: scala/Serializable ... Cannot process toolwindow sbt java.lang.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found