Repository navigation
Language Support for Java extension never finishes starting #2292
Copy link
Copy link
Closed
Labels
Milestone
Description
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
- Open a new VS Code window
- Create a new Java file
- 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
Reactions are currently unavailable
Activity
dineiar commentedon Feb 1, 2022
Reverting to v1.0.0 of the Language Support for Java(TM) 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.
dineiar commentedon Mar 3, 2022
Reinstalled the entire VS Code erasing the config and workspace settings, still same error.
Updated the maven projects and installed the dependencies in the local repository and the extension started working again. I'm still not sure what is going on, but at the very least the error messages are not clear.
ZhehuaMa commentedon Apr 2, 2022
Same issue.
Connecting to a docker container running in a remote host using ssh, testing with a HelloWorld.java, I find the Java Language Server never shows the "Thumbs Up" icon. The Java Build Status terminal outputs nothing.
The logs in Developer Tools:
Java Language Server log:
When I connect to the host rather than the container, testing with the same java file, everything works fine.
Env in container:
OS: Linux 4488f5b72f2d 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
JDK: jdk1.8.0_321
Java Extension: 1.4.0 (March 3rd, 2022)
elizalde1981 commentedon Jul 26, 2022
Same issue here.
The logs in Developer Tools:
mainThreadExtensionService.ts:80 Error: Header must provide a Content-Length property. at p.onData (vscode-file://vscode…ension.js:2:1052283) at Socket.<anonymous> (vscode-file://vscode…ension.js:2:1052004) at Socket.emit (node:events:390:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)
shivamfet commentedon Aug 22, 2022
Same issue. Workaround is not working for me.
rgrunber commentedon Aug 26, 2022
What happens if you try
-Xlog:disable? This should disable all logging.You can still keep the other vmargs (just to be consistent with the default) :
XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable.shivamfet commentedon 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"
rgrunber commentedon Aug 26, 2022
@testforstephen , @fbricon , we may want to consider having
-Xlog:disable(only if CLIENT_PORT/CLIENT_HOST not set?) (see #2646 (review)) . There's no way to know which logging facility under the JVM may decide to interrupt the communication.testforstephen commentedon Aug 29, 2022
Since
-Xlogis used to control the logs printed by the JVM's own built-in components and has no effect on the Java Language Server's log handler, it looks fine to disable it.Disable JVM logging by default.
Disable JVM logging by default.