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

Can not launch junit tests anymore #1494

Closed
SHemmis opened this issue Oct 5, 2022 · 16 comments
Closed

Can not launch junit tests anymore #1494

SHemmis opened this issue Oct 5, 2022 · 16 comments

Comments

@SHemmis
Copy link

SHemmis commented Oct 5, 2022

Environment

System : Linux Mint 19.2 (Tina)
JDK: openjdk version "17.0.4" 2022-07-19 (build 17.0.4+8-Ubuntu-118.04)
VSCode: v1.71.2
redhat.java: v1.11.0
vscjava.vscode-java-test: v0.37.1
vscjava.vscode-java-debug: v0.44.0

Symptom

This is basically the same issue (at least the same symptoms) as in #1481
This started happening from 1 day to the next on all my projects and workspaces (last week tuesday everything seemed ok, wednesday morning none of my unit tests would run).
If I try to run a junit test the following popup with message "Run Tests: Resolving launch configuration" appears and never disappears

image

I attached a project where this happens, but I assume this is not related to the project itself since it happens on all projects.
I can't find a good reason or trigger why this happened overnight.

The test runner for java is at 0.37.1, but even with the pre-release version it doesn't work.

sudoku.zip

@SHemmis
Copy link
Author

SHemmis commented Oct 5, 2022

I'd also like to add my global settings from ~/.config/Code/User

{
    "telemetry.enableTelemetry": false,
    "telemetry.enableCrashReporter": false,
    "java.semanticHighlighting.enabled": true,
    "java.requirements.JDK11Warning": false,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "gitlens.gitCommands.skipConfirmations": [
        "fetch:command",
        "stash-push:command",
        "switch:command",
        "push:command"
    ],
    "workbench.colorTheme": "Visual Studio Dark",
    "editor.renderControlCharacters": true,
    "editor.fontSize": 12,
    "workbench.startupEditor": "newUntitledFile",
    "jestrunner.runOptions": [
        "-i"
    ],
    "workbench.editor.enablePreviewFromQuickOpen": false,
    "workbench.editor.closeOnFileDelete": true,
    "workbench.editor.highlightModifiedTabs": true,
    "workbench.editor.scrollToSwitchTabs": true,
    "java.completion.filteredTypes": [
        "com.sun.*"
    ],
    "java.configuration.runtimes": [
    
        {
            "name": "JavaSE-1.8",
            "path": "/usr/lib/jvm/java-8-openjdk-amd64",
            "default":true
          },
          {
            "name": "JavaSE-11",
            "path": "/usr/lib/jvm/java-11-openjdk-amd64",
          },
          {
            "name": "JavaSE-17",
            "path": "/usr/lib/jvm/java-17-openjdk-amd64",
          }
    ],
    "java.jdt.ls.java.home": "/usr/lib/jvm/java-1.17.0-openjdk-amd64",
    "extensions.ignoreRecommendations": false,
    "git.allowForcePush": true,
    "java.checkstyle.properties": {
    
    },
    "spring-boot.ls.java.home": "/usr/lib/jvm/java-11-openjdk-amd64",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "java.debug.settings.hotCodeReplace": "auto",
    "telemetry.telemetryLevel": "off",
    "gitlens.plusFeatures.enabled": false,
    "gitlens.showWhatsNewAfterUpgrades": false,
    "gitlens.showWelcomeOnInstall": false,
    "files.hotExit": "off",
    "maven.terminal.useJavaHome": true,
    "terminal.integrated.scrollback": 9999,
    "window.restoreWindows": "none",
    "boot-java.live-information.automatic-connection.on": false,
    "git.enableSmartCommit": true,
}

@SHemmis
Copy link
Author

SHemmis commented Oct 6, 2022

The biggest issue is that I don't have a warning or error or something message that could give me a hint on where search for the problem...

@SHemmis
Copy link
Author

SHemmis commented Oct 6, 2022

I tried reverting vscjava.vscode-java-debug to v0.43.0 (was updated mid last week, so a potential cause), but this didn't help.

@jdneo
Copy link
Member

jdneo commented Oct 8, 2022

Have you tried triggering the command Java: Clean Java language server workspace?

And meanwhile, instead of running tests, does launching main method work?

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

@jdneo ,

Thank you for your suggestions.

The "Java: Clean Java language server workspace" doesn't help.
And indeed. launching a main method doesn't work either.
I get the small debug popup window (with pause, step over, step in, step out, restart and stop button),
and a blue loader thingy underneath the RUN AND DEBUG menu (left column)

image

I started looking at logs and found that in the "Language support for java (Syntax Server)" output,

There is this error message.

WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
[Error - 08:17:25] Connection to server got closed. Server will not be restarted.

I restarted VSCode and saw that this message is there at startup; so not (direcly) linked to running a test; but maybe it's an indicator that could help figuring out what's going wrong?

@jdneo
Copy link
Member

jdneo commented Oct 10, 2022

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

In attachment you can find the logging from
Language Server for Java (LSfj.txt), Language Server for Java (Syntax server) (LSfJSyntax.txt), and the additional logging that happens when running a junit test. (LSfj-runJunitTest.txt)

Starting the main method didn't add any logs in these 2.
I cannot see any obvious errors.

LSfj.txt
LSfj-runJunitTest.txt
LSfJSyntax.txt

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

The developer tools console does show some errors at startup:
vscode-app-1665387311865.log

The Java Language Server log file doesn't contain errors:
JavaLanguageServerLog.txt

@jdneo
Copy link
Member

jdneo commented Oct 10, 2022

Looks like related with this issue : redhat-developer/vscode-java#2577 (comment)

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

Indeed, it does look similar.

I tried adding (all 3) suggested changes from #2577 to the settings.json:

    "java.debug.settings.vmArgs": "-Xlog:jni+resolve=off",
    "spring-boot.ls.java.vmargs": ["-Xlog:jni+resolve=off"],    
    "java.jdt.ls.vmargs": "-Xlog:jni+resolve=off",

But it doesn't help. The Developer Tools console keeps showing this "Header must provide a Content-Length property" error message, and junit tests or java main still doesn't run.

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

Eureka!
I've tried the suggestion from spring-projects/sts4#811
(using -Xlog:disable)

    "java.jdt.ls.vmargs": "-Xlog:disable",

And this works.
I can run junit tests and java applications again.
Not sure how to proceed from here.
For me the issue is solved by having a workaround,
but it has been a pain, and I'm afraid that when I'll have to do a reinstall; or move to a new machine, I'll have the same issue again.

@jdneo
Copy link
Member

jdneo commented Oct 10, 2022

The latest redhat.java should already use that argument as default value. Will it stop working if you remove java.jdt.ls.vmargs? (Make sure all extensions are update to date)

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

Aha. Indeed that's not the one that did it, I also added the -Xlog:disable to the spring-boot.ls.java.vmargs

"spring-boot.ls.java.vmargs": [
        "-Xlog:disable"
    ],

If I remove this one, it stops working.

@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

Disabling the Spring Boot Tools plugin also helps

@jdneo
Copy link
Member

jdneo commented Oct 10, 2022

Thanks for sharing the findings. I'll close this issue since it looks like the problem is not caused by this extension.

BTW, maybe file an issue at Spring Boot Tools plugin's repo?

@jdneo jdneo closed this as completed Oct 10, 2022
@SHemmis
Copy link
Author

SHemmis commented Oct 10, 2022

@jdneo,

thanks for your help.
The issue spring-projects/sts4#811 seems to cover this issue.

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

No branches or pull requests

2 participants