vscode-java
vscode-java copied to clipboard
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
- Install jdk and VSCode
- Install the Extension Pack for Java
- Update settings.json to point to jdk:
"java.jdt.ls.java.home": "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.3.7-hotspot" - Open any .java file
same issue on:
VS code versions 1.68.1 and 1.67.0 RedHat Java extension 1.7.0, 1.8.0, 1.90 (multiple combinations of the above were tried, all had same issue)
JDK version 11.0.12 (oracle)
i hope this is fixed soon because i straight up cannot work on java properly in vs code right now
Seems to be similar to #2292
same issue here, out of the blue it just stopped working.
Operating System: Windows 10 Enterprise (10.0.19044) JDK version: tried a couple all through JAVE_HOME; Oracle 11.0.15 , OpenJDK 17 (Oracle / Redhat / MS) Visual Studio Code version: 1.69.2 Java extension version: v1.9.0
mainThreadExtensionService.ts:79 [[object Object]]Header must provide a Content-Length property.
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
mainThreadExtensionService.ts:80 Error: Header must provide a Content-Length property.
at p.onData (c:\Users\LeeVic\.vscode\extensions\redhat.java-1.9.0-win32-x64\dist\extension.js:2:1052283)
at Socket.<anonymous> (c:\Users\LeeVic\.vscode\extensions\redhat.java-1.9.0-win32-x64\dist\extension.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)
Also happening to me. Its very annoying. I have to switch to Eclipse for now

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.
@muchida6 I am also facing the same issue. Getting same warning with Javac -version command in cmd as well. Can you bit more specific where to add the vmargs. I tried to add in vscode settings.json. But no luck.
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.

Thanks @MarcSerret51 . It is working now.
@muchida6 thanks for finding that out. Where did you see the "Re-registering of platform native method: java.lang.PanwHooks.NativeMethodEntry" response? in some logs or while debugging vscode?
I would also like to know where this response was found. I didn't see it locally but that could just mean I missed an important debug step
@muchida6 Great Thanks!! btw, now junit test stuck at resolving launch config from debugger for java extension, but I can live with that :-D
@fbricon @Foxhunter981 I was just trying to debug.

@victorlee0505 Running the junit test by vscode-java-test worked for me, though vscode-java-test has vmArgs in java.test.config (https://github.com/Microsoft/vscode-java-test/wiki/Run-with-Configuration),
so adding -Xlog:jni+resolve=off might work better. I hope this helps.
i added these 2 enties in setting.json to make test runner and springboot dashboard works!
"java.debug.settings.vmArgs": "-Xlog:jni+resolve=off",
"spring-boot.ls.java.vmargs": ["-Xlog:jni+resolve=off"],
@muchida6 thank's dude it's working on me :)
@muchida6 I spent so many hours trying to figure this out. Your solution was the answer. Thank you so much!
I'm not having this specific problem, but the related problem mentioned here https://github.com/redhat-developer/vscode-java/issues/2623
Regardless, VS Code is basically the equivalent of notepad on windows for me, until this is fixed.
@jmihalichuber could you, please, attach your logs - Enable Logging
Hi Joe @jmihalichuber Did you find any solution i am also stuck, i tried the workaround it is not working.?
Does installing another version will help ?