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.

Language Support for Java extension never finishes starting

See original GitHub issue

Whenever the extension activates, its icon on the bottom-right starts “loading” and never turns into the “Thumbs Up” icon. Able to reproduce with individual Java files and Maven projects.
Best problem indication so far is the console log “Error: Header must provide a Content-Length property”.

The practical result is that the extension does not work at all (code navigation, intellisense, etc).

Environment
  • Operating System: KDE neon (Linux hostname 5.4.0-72-generic 80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux)
  • JDK version: OpenJDK jdk-11.0.10+9
  • Visual Studio Code version: Version: 1.63.2 Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3 Date: 2021-12-15T09:39:46.686Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Linux x64 5.4.0-72-generic snap
  • Java extension version: v1.2.0
  • Other extensions installed:
    • Dart
    • Docker
    • Flutter
    • GitLens
    • JSON Tools
    • LaTeX Workshop
    • Vagrant
    • vscode-faker
    • XML Tools
Steps To Reproduce
  1. Open a new VS Code window
  2. Create a new Java file
  3. The extension icon on the bottom-right starts “loading” and never turns into the “Thumbs Up” icon.

Also happens when I open a Maven project (my real-world use case).

What I’ve tried so far
  • Removed /home/username/.config/Code/User/workspaceStorage/ folder
  • F1 > Java: Clean Java Language Server Workspace
  • Uninstalled Java extension pack and installed only the Language Support for Java extension
  • Checked that I do not have the Visual Studio IntelliCode extension (according to this issue)
Logs

I set the java.trace.server setting to verbose and the extension log file got pretty big (1.4k lines), so I pasted it in pastebin (link below).

The VSCode’s Developer Tools Console shows errors such as:

Error: Header must provide a Content-Length property.
	at m.onData (vscode-file://vscode-app/home/username/.vscode/extensions/redhat.java-1.2.0/dist/extension.js:2)
	at Socket.<anonymous> (vscode-file://vscode-app/home/username/.vscode/extensions/redhat.java-1.2.0/dist/extension.js:2)
	at Socket.emit (events.js:315)
	at addChunk (internal/streams/readable.js:309)
	at readableAddChunk (internal/streams/readable.js:284)
	at Socket.Readable.push (internal/streams/readable.js:223)
	at Pipe.onStreamRead (internal/stream_base_commons.js:188)

Java Extension log file: https://pastebin.com/nwL6SBS1

Java Language Server log file:

!SESSION 2022-01-20 11:02:57.307 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en
Command-line arguments:  -data /home/username/.config/Code/User/workspaceStorage/1f338313d7b0a52013fc61c6213cc67e/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:58.449
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:58.615
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:58.652
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:58.654
!MESSAGE Initializing Java Language Server 1.7.0.202112160206

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.125
!MESSAGE Setting java.home /home/username/bin/jdk-11.0.10+9 as default global VM

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.132
!MESSAGE Default VM Install changed from  1642687379113-/home/username/.vscode/extensions/redhat.java-1.2.0/jre/17.0.1-linux-x86_64 to 1642687379125-/home/username/bin/jdk-11.0.10+9

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.142
!MESSAGE JVM Runtimes changed, saving new configuration

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.146
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.147
!MESSAGE Non-Static Commands: [java.edit.organizeImports, java.project.refreshDiagnostics, java.project.import, java.navigate.openTypeHierarchy, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.resolveStackTraceLocation, java.project.getAll, java.project.isTestFile, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.stringFormatting, java.project.getSettings, java.project.updateSourceAttachment, java.project.resolveSourceAttachment, java.project.addToSourcePath]

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.150
!MESSAGE Wait for AutoBuildOffJob start

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.161
!MESSAGE Wait for AutoBuildOffJob end 11ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.161
!MESSAGE Starting org.eclipse.m2e.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.162
!MESSAGE Started org.eclipse.m2e.core 1ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.162
!MESSAGE ProjectRegistryRefreshJob finished 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.162
!MESSAGE Starting org.eclipse.buildship.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.174
!MESSAGE Started org.eclipse.buildship.core 12ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.185
!MESSAGE LoadingGradleVersionJob finished 11ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.193
!MESSAGE Creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.239
!MESSAGE Finished creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:02:59.815
!MESSAGE Importing Maven project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:03:03.539
!MESSAGE Workspace initialized in 4352ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:08.799
!MESSAGE Parent process stopped running, forcing server exit

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:08.800
!MESSAGE Shutdown received... waking up main thread

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:08.818
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is stopping:

!ENTRY org.eclipse.core.resources 2 10035 2022-01-20 11:07:09.431
!MESSAGE The workspace will exit with unsaved changes in this session.
!SESSION 2022-01-20 11:07:09.592 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en
Command-line arguments:  -data /home/username/.config/Code/User/workspaceStorage/1f338313d7b0a52013fc61c6213cc67e/redhat.java/jdt_ws

!ENTRY org.eclipse.core.resources 2 10035 2022-01-20 11:07:10.251
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.690
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.817
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.842
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.843
!MESSAGE Initializing Java Language Server 1.7.0.202112160206

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.859
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.860
!MESSAGE Non-Static Commands: [java.edit.organizeImports, java.project.refreshDiagnostics, java.project.import, java.navigate.openTypeHierarchy, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.resolveStackTraceLocation, java.project.getAll, java.project.isTestFile, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.stringFormatting, java.project.getSettings, java.project.updateSourceAttachment, java.project.resolveSourceAttachment, java.project.addToSourcePath]

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.864
!MESSAGE Starting org.eclipse.m2e.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:10.865
!MESSAGE Started org.eclipse.m2e.core 1ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:11.574
!MESSAGE ProjectRegistryRefreshJob finished 709ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:11.575
!MESSAGE Starting org.eclipse.buildship.core

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:11.610
!MESSAGE Started org.eclipse.buildship.core 35ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:11.625
!MESSAGE LoadingGradleVersionJob finished 14ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:12.254
!MESSAGE Importing Maven project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-01-20 11:07:12.369
!MESSAGE Workspace initialized in 743ms

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
dineiarcommented, Feb 9, 2022

~Reverting to v1.0.0 of the Language Support for Java™ by Red Hat extension solved the problem.~

~One can do this by opening the extension page, click on the little arrow icon besides “Uninstall” button and then select “Install Another Version…”~

– Edit – It did not solve the problem after all. It seemed like it was working, but as soon as I opened a Maven project it started crashing again.

1reaction
rgrunbercommented, Aug 26, 2022

Thank you so much @rgrunber .

This has fixed the issue for me:

“java.jdt.ls.vmargs”: “-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable”

@testforstephen , @fbricon , we may want to consider having -Xlog:disable (only if CLIENT_PORT/CLIENT_HOST not set?) (see https://github.com/redhat-developer/vscode-java/pull/2646#pullrequestreview-1087232354) . There’s no way to know which logging facility under the JVM may decide to interrupt the communication.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java on Visual Studio Code FAQ and Wiki
Frequent Asked Questions. Thanks for your interest in Java on Visual Studio Code! This FAQ will hopefully answer some of the questions you...
Read more >
Starting Java Language server stuck at 37% in Visual Studio ...
I have just installed the Visual Studio code and redhat.java (Language support for Java by RedHat). I have added a new folder to...
Read more >
redhat-developer/vscode-java - Gitter
I'am starting on using VSCode for Spring Boot projects and when using Gradle ... I've got the "Language Support for Java" and "Tomcat...
Read more >
Troubleshooting tips for running Java
Close all of the browser windows, then reopen any web pages that require Java. In most cases starting a new browser session should...
Read more >
Java on Visual Studio Code Update – January 2022
1.0 release of Language Support for Java™ ... Besides the core Java extension releases, there were also exciting updates in remote ...
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