Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension never activates, throwing error "Header must provide a Content-Length property" #2577

Closed
atcericandrews opened this issue Jul 19, 2022 · 19 comments · Fixed by #2646

Comments

@atcericandrews
Copy link

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

@devin-lo
Copy link

devin-lo commented Jul 25, 2022

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

@elizalde1981
Copy link

Seems to be similar to #2292

@victorlee0505
Copy link

victorlee0505 commented Jul 27, 2022

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)

@Foxhunter981
Copy link

Also happening to me. Its very annoying. I have to switch to Eclipse for now
image

@muchida6
Copy link

muchida6 commented Aug 9, 2022

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.

@sudheerkkumar
Copy link

@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.

@MarcSerret51
Copy link

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

@sudheerkkumar
Copy link

Thanks @MarcSerret51 . It is working now.

@fbricon
Copy link
Collaborator

fbricon commented Aug 9, 2022

@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?

@Foxhunter981
Copy link

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

@victorlee0505
Copy link

@muchida6 Great Thanks!! btw, now junit test stuck at resolving launch config from debugger for java extension, but I can live with that :-D

@muchida6
Copy link

muchida6 commented Aug 9, 2022

@fbricon @Foxhunter981 I was just trying to debug.
image

@muchida6
Copy link

muchida6 commented Aug 9, 2022

@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.

@victorlee0505
Copy link

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"],

@jundiaufa11
Copy link

@muchida6 thank's dude it's working on me :)

@jgriffin1
Copy link

@muchida6
I spent so many hours trying to figure this out. Your solution was the answer. Thank you so much!

@ghost
Copy link

ghost commented Aug 17, 2022

I'm not having this specific problem, but the related problem mentioned here
#2623

Regardless, VS Code is basically the equivalent of notepad on windows for me, until this is fixed.

@snjeza
Copy link
Contributor

snjeza commented Aug 17, 2022

@jmihalichuber could you, please, attach your logs - Enable Logging

@shivamfet
Copy link

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 ?

rgrunber added a commit to rgrunber/vscode-java that referenced this issue Sep 22, 2022
- Since any JVM component may invoke logging, it may be best to disable
  all logging
- Related redhat-developer#2577
- Fixes redhat-developer#2292

Signed-off-by: Roland Grunberg <[email protected]>
rgrunber added a commit that referenced this issue Sep 23, 2022
- Since any JVM component may invoke logging, it may be best to disable
  all logging
- Related #2577
- Fixes #2292

Signed-off-by: Roland Grunberg <[email protected]>
@testforstephen testforstephen unpinned this issue Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.