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.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
muchida6commented, 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.

4reactions
MarcSerret51commented, Aug 9, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does my JavaScript code receive a "No 'Access-Control ...
I know that the API or remote resource must set the header, but why did it work when I made the request via...
Read more >
5.x API - Express.js
Alterations to the headers must occur synchronously. ... When a callback function throws an error or returns a rejected promise, `next(err)` will be...
Read more >
Request · Cloudflare Workers docs
This code snippet will throw during script startup, and the "fetch" event listener will never be registered. ​​ Set the Content-Length header.
Read more >
API — Flask Documentation (2.2.x)
The idea of the first parameter is to give Flask an idea of what belongs to your application. ... The key must match...
Read more >
Web on Servlet Stack - Spring
If you use XML-based Spring configuration, you should extend directly from ... are used to resolve exceptions thrown during request processing.
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