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

[BUG] java.lang.NoClassDefFoundError causes freeze of code analysis #113

Open
RaphaelTarita opened this issue Sep 30, 2020 · 9 comments
Open

Comments

@RaphaelTarita
Copy link

I don't know what exactly I've done to cause this, but as of now, I can't perform the standard IntelliJ code analysis in my TornadoFX project as long as the TornadoFX plugin is active. I've tried everything, from restarting the IDE, disabling and enabling the plugin and also restarting the PC.

The IDE Error Log shows the following stacktrace of the error caused by the TornadoFX plugin:

java.lang.NoClassDefFoundError: javafx/scene/paint/Color
	at no.tornado.tornadofx.idea.annotator.CSSColorAnnotator.toColorType(CSSColorAnnotator.kt:166)
	at no.tornado.tornadofx.idea.annotator.CSSColorAnnotator.annotateTFXColor(CSSColorAnnotator.kt:113)
	at no.tornado.tornadofx.idea.annotator.CSSColorAnnotator.handelProperty(CSSColorAnnotator.kt:69)
	at no.tornado.tornadofx.idea.annotator.CSSColorAnnotator.handelProperty$default(CSSColorAnnotator.kt:66)
	at no.tornado.tornadofx.idea.annotator.CSSColorAnnotator.annotate(CSSColorAnnotator.kt:61)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:136)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:116)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:338)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:271)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:297)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:300)
	at com.github.izhangzhihao.rainbow.brackets.visitor.RainbowHighlightVisitor.analyze(RainbowHighlightVisitor.kt:35)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:300)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:300)
	at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:96)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:300)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:268)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:214)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:80)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:54)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:399)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1110)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:392)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:391)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:367)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:170)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:365)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:181)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: java.lang.ClassNotFoundException: javafx.scene.paint.Color PluginClassLoader[PluginDescriptor(name=TornadoFX, id=no.tornado.tornadofx.idea, path=D:\JetBrains\IntelliJ\config\plugins\tornadofx-idea-plugin, version=1.7.20)] com.intellij.ide.plugins.cl.PluginClassLoader@32755498
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:95)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 37 more

This error apparently causes the IDE code analysis to freeze or hang. In the top right corner of the editor, you normally see a badge with the number of warnings and errors in the current file. This badge is stuck to just displaying "Analyzing...". The "Problems" pane also just shows "Analyzing [File]". While this analysis is stuck, I don't have any error highlighting and also a greatly reduced syntax highlighting (just like the version you ususally see when you just opened up a project).

As I said, I don't really know what caused the error, but it seems to be linked to the file I was working on. For further information, here's that file:

package com.example

import javafx.scene.paint.Color
import javafx.scene.paint.Paint
import tornadofx.*

class Styles : Stylesheet() {
    companion object {
        // ======color palette======
        // b / w
        val white: Paint = Color.WHITE
        val textWhite: Paint = Color.ANTIQUEWHITE
        val black: Paint = Color.BLACK
        val textBlack: Paint = c("#0e1111")

        // primary
        val primary: Paint = c("#304ffe")
        val primaryLight: Paint = c("#7a7cff")
        val primaryDark: Paint = c("#0026ca")

        // secondary
        val secondary: Paint = c("#ff4081")
        val secondaryLight: Paint = c("#ff79b0")
        val secondaryDark: Paint = c("#c60055")
    }

    init {
        button {
            backgroundRadius += box(20.px)
            backgroundColor += primary
            textFill = textWhite

            and(hover) {
                backgroundColor += secondary
            }

            and(pressed) {
                backgroundColor += primaryDark
            }
        }

        tab {
            backgroundColor += white
            backgroundRadius += box(10.px, 10.px, 0.px, 0.px)

            and(selected) {
                backgroundColor += primaryLight
            }
        }
    }
}

Some version data:

  • IntelliJ IDEA Ultimate 2020.2
  • Kotlin/JVM 1.4.0
  • TornadoFX Plugin 1.7.20
  • Microsoft Windows 10 Pro (10.0.18363)
@RaphaelTarita
Copy link
Author

RaphaelTarita commented Sep 30, 2020

I tried a lot of other things (like removing the imports and all references to javafx.scene.paint.Color/Paint), but ultimately, uninstalling and re-installing the TornadoFX Plugin resolved the problem. I still don't know why it happened or how long it will take until I run into the same issue again, but it is a working quick fix.

Edit: Nope, wrong. Apparently, after uninstalling and reinstalling the plugin, it was still set to "disabled". That's why everything worked fine. Re-enabling the plugin brought back all problems.

@iguanastin
Copy link

I'm having the same issue exactly. Hope this gets fixed soon, as it's a major annoyance.

@arm32x
Copy link

arm32x commented Nov 12, 2020

I'm having the same issue. Could it be related to the package name change in Java 9 (com.sun.javafx to javafx)? As far as I know, the bundled JRE is Java 8, so it wouldn't have the new package.

@RaphaelTarita
Copy link
Author

I'm not sure about this. The javafx change in Java 9 is a major topic in tornadofx, but it has been addressed. Now of course, this does not necessarily have to be the case for the IntelliJ plugin, but the logical implication of this would be that the plugin would fail for any symbol imported from javafx. Which is not the case AFAIK.

But on the other hand it would be a reasonable explanation. I really don't know.

@liugangnhm
Copy link

use IDEA with java8 bundled can fix the issue

@dkowis
Copy link

dkowis commented Feb 7, 2021

Yeah. I can't keep using java8 as the javafx community has moved on. I will have to disable the plugin :(

@liugangnhm
Copy link

liugangnhm commented Mar 24, 2021

Yeah. I can't keep using java8 as the javafx community has moved on. I will have to disable the plugin :(

you can delete that feature from your plugin jar file:

<annotator language="kotlin" implementationClass="no.tornado.tornadofx.idea.annotator.CSSColorAnnotator" order="first"/>

tornadofx-idea-plugin\lib\tornadofx-idea-plugin-1.7.17.2.jar\META-INF\plugin.xml

@misty000
Copy link

if use java 8
copy jdk1.8.0/jre/lib/ext/jfxrt.jar to IntelliJIdea/plugins/tornadofx-idea-plugin/lib
restart idea

@lhDream
Copy link

lhDream commented Mar 16, 2023

if use java 9+
install JavaFX Runtime for plugins
restart idea

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