vscode-java: Error: The Language Support for Java server crashed 5 times in the last 3 minutes. The server will not be restarted.

This extension cannot start successfully and popup this error message. I found some logs in the output, hope it can help: [Info - 11:24:22 AM] Connection to server got closed. Server will restart. [Info - 11:24:23 AM] Connection to server got closed. Server will restart. [Warn - 11:24:24 AM] Dec 6, 2016 11:24:24 AM The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes. [Info - 11:24:25 AM] Connection to server got closed. Server will restart. [Warn - 11:24:26 AM] Dec 6, 2016 11:24:26 AM The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes. [Info - 11:24:26 AM] Connection to server got closed. Server will restart. [Warn - 11:24:27 AM] Dec 6, 2016 11:24:27 AM The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes. [Error - 11:24:27 AM] Connection to server got closed. Server will not be restarted.

Environment
  • Operating System: Windows 7 Enterprise
  • JDK version: 1.8.0_40 (Setting JAVA_HOME environment variable only)
  • Visual Studio Code version: 1.7.2
  • Java extension version: 0.0.7
Steps To Reproduce
  1. Download and install vscode 1.7.2
  2. Search and install this extension: Language Support for Java™ by Red Hat
  3. Open a .java file to start this extension
  4. (Optional) Check the popup message and output logs
Additional Informations

I installed the same-version vscode and extension to another machine whose system is Windows 10, and the extension can work as expected.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 7
  • Comments: 70 (6 by maintainers)

Most upvoted comments

try the “Java: clean the Java Language server workspace” command

@snjeza I was able to solve my problem, just install the lombook extension that worked. Very tks 😃

For me the fix was removing the javaagent argument which was added to the vmargs in the settings.json .
It’s still unclear why this lombar.jar was added. The project I’m working on doesn’t use lombok.

Where to find the settings.json.
I’m on Mac so these steps might be a bit different on other system.

Goto Preferences -> Settings
In Settings goto Extensions -> Java
Scroll down and a few of the entries have a link which says Edit in settings.json .
Click on this link to open settings.json .
There should be a key which contains the vmargs: “java.jdt.ls.vmargs”
At the end of the defined value I found the javaagent which pointed to lombok.jar .
Remove this part.
It should now only say something like:
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m" After altering this value, VScode will prompt you to restart.
When VScode had restarted the error was gone.

I had a very similar error on macOS. It might have started happening after I upgraded VS Code.

What worked for me was to delete this directory:

~/Library/Application Support/Code/User/workspaceStorage

Warning: you will have to set up your workspaces after doing this.

Just clarify the requirement about vscode-lombok extension.

  • If your project doesn’t use any lombok annotation feature, you don’t need install vscode-lombok extension.
  • When you installed vscode-lombok extension before, and uninstalled it recently, you must clean up the user setting java.jdt.ls.vmargs, too.
    • When you installed vscode-lombok, it will modify your user setting and append a parameter -javaagent:\"/Users/myName/.vscode-insiders/extensions/gabrielbb.vscode-lombok-1.0.1/server/lombok.jar\"" to the jvmArgs.
    • When you uninstalled it, it won’t remove the jvmArgs, that will cause the vscode-java broken because of lombok.jar not existing.

Has the Java RE version requirements been increased to require at least OpenJDK 12.0 or up?

I’m starting to think Java 8 is no longer compatible with the latest VS Code.

But it is working fine after installing vs-lambok, I don’t know why, but yes it is working fine. Please help to understand why lambok is resolving the error ?

No, it didn’t actually work for me, even with “vscode-lombok” extension installed.

I was missing a extenstion https://marketplace.visualstudio.com/items?itemName=GabrielBB.vscode-lombok installed and everything worked fine

Confirming this was the.issue. thanks!

I think this issue and other similar can be closed.

Clean the workspace, either by command prompt or by deleting the “C:\Users\Dhruv\AppData\Roaming\Code\User” Folder. You can find the exact link for the folder in the debug log text.

@guilhermefelipesilva please see https://github.com/redhat-developer/vscode-java/issues/112#issuecomment-508757427 Your logs are in ~/.vscode/extensions/redhat.java-*/server/config_linux/

@fbricon Ok I cloned the repo, opened it with vscode, launched in debug and it stopped. It launched and I opened a java project.

When it stopped, err was null, I stepped over several times. It got to <node_internals>\net.js#L1455 and it got to the breakpoint again, but the new vscode project window had this log:

log2.txt

I don’t know much javascript, so I’m not sure I can help more than that but I’ll do my best. If there’s anything specific I should be looking for, please let me know.

I’d like to point out that the project I’m trying to open is not an eclipse project (no eclipse files anywhere), just a java maven project.

Edit: I just tried removing and completely purging all vscode stuff from my machine, and reinstalled. Problem persists on my work machine, but sadly I cannot reproduce on my PC at home with same versions of OS, JDK, project, and extensions.

@ofir-popowski no, other IDEs should not interfere.

Do you think you could try to debug vscode-java yourself? (since we can’t reproduce, it’s hard to guess what’s happening). If you’re up to the task, you could follow the instructions to launch vscode-java from vscode, and put a breakpoint in https://github.com/redhat-developer/vscode-java/blob/master/src/javaServerStarter.ts#L55, see what happens

I got this to work again by wiping out my repository and forcing it to regenerate all of the eclipse .prefs files. Not sure how any of it got messed up, but it’s a workaround at least.