Running multiple fastOptJS causes java.lang.NoClassDefFoundError: jdk/internal/reflect/MethodAccessorImpl
See original GitHub issueSymptom:
- MethodAccessorImpl NoClassDefError happens with Scala.js 1.0.0-RC2, when compiling multiple Scala.JS projects. We have no such issue with Scala.js 0.6.x
- After rerunning fastOptJS, the compilation eventually succeeds.
- I’m using sbt 1.3.6 and JDK11. The same error happens with JDK8.
~It might be an issue of sbt-scalajs plugin and sbt-1.3.x’s new classloader.~ (The same problem happens with sbt 1.2.8) I’ll work on reproduction of this issue.
It seems the reflection call of PathOutputFile in the LinkerImpl is failing:
private val outputFileMethod =
loadMethod("PathOutputFile", "atomic", classOf[LinkerOutput.File], classOf[Path])
This is used here:
val out = LinkerOutput(linkerImpl.outputFile(output.toPath))
.withSourceMap(linkerImpl.outputFile(sourceMapFile.toPath)) <--------
.withSourceMapURI(relURI(sourceMapFile.getName))
.withJSFileURI(relURI(output.getName))
A workaround is splitting an aggregated project into a smaller set of projects and running fastOptJS individually.
Issue Analytics
- State:
- Created 4 years ago
- Comments:32 (29 by maintainers)
Top Results From Across the Web
Cannot run gradle test tasks because of java.lang ...
Cannot run gradle test tasks because of java.lang.NoClassDefFoundError: jdk/internal/reflect/GeneratedSerializationConstructorAccessor1 · im ...
Read more >[#FELIX-6184] NoClassDefFoundError: jdk/internal/reflect ...
I recently ran into the following exception when trying to restart a bundle in Felix 23.09.2019 13:18:04.359 *ERROR* [Background Update ...
Read more >Wierd java.lang.NoClassDefFoundError: sun/reflect ...
I have recompiled my code without errors using the new jdk. I am using reflection and do multiple consecutive calls to invoke on...
Read more >JDK 11 causes NoClassDefFoundError AEM 6.5
Caused by: java.lang.ClassNotFoundException: Unable to load class 'jdk.internal.reflect.ConstructorAccessorImpl'.
Read more >Could not initialize class org.jetbrains.kotlin.com.intellij.pom ...
JDK 16 - e: java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm that adding
"sun."
to theparentPrefixes
fixes this problem in a local publish on my machine.Possible workaround: prevent the Scala.js sbt plugin from linking two things at the same time with the following setting: