question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running multiple fastOptJS causes java.lang.NoClassDefFoundError: jdk/internal/reflect/MethodAccessorImpl

See original GitHub issue

Symptom:

  • 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.

image

~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:closed
  • Created 4 years ago
  • Comments:32 (29 by maintainers)

github_iconTop GitHub Comments

1reaction
gzm0commented, Jan 16, 2020

I can confirm that adding "sun." to the parentPrefixes fixes this problem in a local publish on my machine.

1reaction
sjrdcommented, Jan 15, 2020

Possible workaround: prevent the Scala.js sbt plugin from linking two things at the same time with the following setting:

Global / concurrentRestrictions += Tags.limit(ScalaJSTags.Link, 1)
Read more comments on GitHub >

github_iconTop 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 >

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