vscode-java: Extension never activates, throwing error "Header must provide a Content-Length property"

As per the title, the extension never activates; the java language server status never switches to the thumbs-up. The extension runtime status shows 37 copies of the same uncaught error: Header must provide a Content-Length property. The developer tools logs show the same error, slightly more verbosely:

workbench.desktop.main.js:2272 Error: Header must provide a Content-Length property.
	at p.onData (c:\Users\Eric.Andrews\.vscode\extensions\redhat.java-1.8.0-win32-x64\dist\extension.js:2:1138205)
	at Socket.<anonymous> (c:\Users\Eric.Andrews\.vscode\extensions\redhat.java-1.8.0-win32-x64\dist\extension.js:2:1137926)
	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)
Environment
  • Operating System: Windows 10 Enterprise (10.0.19044)
  • JDK version: Eclipse Adoptium 17.0.3.7-hotspot
  • Visual Studio Code version: 1.69.2
  • Java extension version: 1.8.0
Steps To Reproduce
  1. Install jdk and VSCode
  2. Install the Extension Pack for Java
  3. Update settings.json to point to jdk: "java.jdt.ls.java.home": "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.3.7-hotspot"
  4. Open any .java file

language server logs dev tools console logs

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (1 by maintainers)

Commits related to this issue

Most upvoted comments

In my case, adding -Xlog:jni+resolve=off to java.jdt.ls.vmargs solved this problem.

languageclient has receiving rpc response with error messages as follows.

[0.158s][warning][jni,resolve] Re-registering of platform native method: java.lang.PanwHooks.NativeMethodEntry(Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V from code in a different classloader
Content-Length: 780

PanwHooks seems to be related to Palo Alto Networks products, which this product seems to injecting DLLs into the JVM.

I’m getting the same error. The workaround given by @muchida6 worked for me. @sudheerkkumar To add this config line you have to go to Setting and type java.jdt.ls.vmargs and click Edit in settings.json. image