vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

When opening Java Project, the Java Build Status is spinning forever.

Open tarekahf opened this issue 2 years ago • 29 comments

[provide a description of the issue]

Environment
  • Operating System: Windows 10
  • JDK version: JavaSE-1.8 (for the project) and JavaSE-11 for vs code
  • Visual Studio Code version: 1.70.0
  • Java extension version: Extension Pack for Java v0.25.0
Steps To Reproduce
  1. Open Java Project
  2. The Java Build Status indicator on the status bar is spinning forever.
  3. The status bar Java Build status shows an info popup as "Building - Lightweight mode". vscode java build status spinning

[Please attach a sample project reproducing the error] I don't have a sample project now. Will try to make a simple one to verify.

Please attach logs vscode-java logs: vscode-app-1660164678368.log Another log: vscode-app-1660165168557.log Java Language Server's workspace logs: .log

Current Result

Java build status is spinning and the project is not loaded

Expected Result

The project was opening and compiling correctly just last week. I think the recent update broke something.

Additional Informations

The project was opening and compiling correctly just last week. I think the recent update broke something.

tarekahf avatar Aug 10 '22 20:08 tarekahf

workbench.desktop.main.js:2279 Error: Header must provide a Content-Length property.

@tarekahf Your issue is duplicated with https://github.com/redhat-developer/vscode-java/issues/2577#issuecomment-1208922149, pls take a look at the workaround there.

testforstephen avatar Aug 11 '22 04:08 testforstephen

@tarekahf i have a problem like you, try this https://github.com/redhat-developer/vscode-java/issues/2577#issuecomment-1208922149 working on me

jundiaufa11 avatar Aug 11 '22 05:08 jundiaufa11

Thanks all for the reply... Was that magic or what? It worked. I'll wait for tomorrow to confirm. Then you can close. I'll check it using another WiFi connection...

tarekahf avatar Aug 11 '22 13:08 tarekahf

We're also interested in how this happens and see whether we could add that vmArgs on Java extension by default.

testforstephen avatar Aug 11 '22 13:08 testforstephen

Just a quick question about the message I saw about lightweight mode for Java projects. Is there a heavyweight mode and what's the difference? Can you please share a link for details?

tarekahf avatar Aug 11 '22 13:08 tarekahf

Here is the document about lightweight mode. https://code.visualstudio.com/docs/java/java-project#_lightweight-mode

testforstephen avatar Aug 11 '22 14:08 testforstephen

I'm having the same issue, but the workaround mentioned doesn't fix my problem. I have no code even in my project yet. just a basic pom importing two aws dependencies. This just started sometime in the last week. I'm on version 1.70.1. It always seems to get stuck in the "download sources and javadoc" line. that never gets to 100%. it gets to various percentages between 0 and 100 and then just stops.

vscode image

ghost avatar Aug 15 '22 23:08 ghost

I'm having the same issue, but the workaround mentioned doesn't fix my problem. I have no code even in my project yet. just a basic pom importing two aws dependencies. This just started sometime in the last week. I'm on version 1.70.1.

vscode image

For me the problem was resolved but I will wait until this one is also solved. I have another project that uses maven so I'm going to test it out.

tarekahf avatar Aug 15 '22 23:08 tarekahf

I wish there was a way to revert the language server, and not have it auto update.

Until this is fixed, vscode is basically notepad for me. nothing works except typing in code.

image

ghost avatar Aug 15 '22 23:08 ghost

I am also facing the same issue. Mine is maven project.

shivamfet avatar Aug 23 '22 04:08 shivamfet

@shivamfet could you provide a project example?

snjeza avatar Aug 23 '22 18:08 snjeza

Hi @snjeza

Following is the snapshot of project outline, it is a maven project. Hope it helps

image

This is the remote-settings.json file

`{
"java.jdt.ls.java.home": "/usr/java/jdk-17.0.2", "java.jdt.ls.vmargs": "-Xlog:jni+resolve=off", "java.dependency.syncWithFolderExplorer": true, "http.proxy": "...",
"http.proxyStrictSSL": false, "maven.executable.path": "...", "maven.settingsFile": "...", "maven.executable.options" : ".....", "files.exclude": {

    }

}`

shivamfet avatar Aug 23 '22 19:08 shivamfet

Hi @snjeza

Developer Tools log says:

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 (/home/skakkar/.vscode-server/extensions/redhat.java-1.9.0/dist/extension.js:2:1052283) at Socket.<anonymous> (/home/skakkar/.vscode-server/extensions/redhat.java-1.9.0/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) $onExtensionRuntimeError @ mainThreadExtensionService.ts:80 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 (/home/skakkar/.vscode-server/extensions/redhat.java-1.9.0/dist/extension.js:2:1052283) at Socket.<anonymous> (/home/skakkar/.vscode-server/extensions/redhat.java-1.9.0/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)

shivamfet avatar Aug 23 '22 19:08 shivamfet

@shivamfet What OS are you using?

snjeza avatar Aug 23 '22 19:08 snjeza

Hi @snjeza

My vscode is installed on MAC OS Monterey version 12.1.

I am doing remote development and remote development box is Linux x64

Thanks Shivam

shivamfet avatar Aug 24 '22 02:08 shivamfet

Hi @snjeza Sorry to bug you again. Any pointers or workaround if you can suggest it will be really helpful.

Regards Shivam

shivamfet avatar Aug 25 '22 16:08 shivamfet

@shivamfet I'm working on it.

snjeza avatar Aug 25 '22 23:08 snjeza

A related issue - https://github.com/redhat-developer/vscode-java/pull/2646

snjeza avatar Aug 26 '22 19:08 snjeza

@shivamfet Could you check https://github.com/snjeza/vscode-test/raw/master/java-1.10.0.vsix ? It includes https://github.com/redhat-developer/vscode-java/pull/2646/

You should remove

"java.jdt.ls.vmargs": "-Xlog:jni+resolve=off",

It will be added automatically

snjeza avatar Aug 26 '22 19:08 snjeza

@shivamfet Could you check https://github.com/snjeza/vscode-test/raw/master/java-1.10.0.vsix ? It includes #2646

You should remove

"java.jdt.ls.vmargs": "-Xlog:jni+resolve=off",

It will be added automatically

I have opened an old project which is maven-based using vscode. I am 100% sure it was working fine several months ago. No, it is not working. I see the build status indicator spinning forever on the status bar.

Update: I added the fix below to the settings file and it worked fine now:

"java.jdt.ls.vmargs": "-Xlog:jni+resolve=off"

Try to open this repo in vs code: https://github.com/javalite/jar-explorer

The above is a sample project that uses maven.

tarekahf avatar Aug 29 '22 18:08 tarekahf

@tarekahf What version of VS Code are you using?

snjeza avatar Aug 29 '22 19:08 snjeza

@tarekahf What version of VS Code are you using?

I got the following from vs code help/about:

Version: 1.70.2 (user setup) Commit: e4503b30fc78200f846c62cf8091b76ff5547662 Date: 2022-08-16T05:35:13.448Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19042

tarekahf avatar Aug 29 '22 20:08 tarekahf

@tarekahf Could you try to install https://github.com/snjeza/vscode-test/raw/master/java-1.10.0.vsix

snjeza avatar Aug 29 '22 22:08 snjeza

@tarekahf Could you try to install https://github.com/snjeza/vscode-test/raw/master/java-1.10.0.vsix

But why? it's working for me now.

tarekahf avatar Aug 29 '22 23:08 tarekahf

But why? it's working for me now.

"-Xlog:jni+resolve=off" will be added automatically. See https://github.com/redhat-developer/vscode-java/pull/2646

snjeza avatar Aug 30 '22 00:08 snjeza

You mean if I download this

https://github.com/snjeza/vscode-test/raw/master/java-1.10.0.vsix

Then the settings

"-Xlog:jni+resolve=off"

will be added automatically?

Will this happen for existing project, new project, or both? Will it apply For maven based project, no-build tool project, or both?

tarekahf avatar Aug 30 '22 00:08 tarekahf

will be added automatically?

Right!

Will this happen for existing project, new project, or both? Will it apply For maven based project, no-build tool project, or both?

It should be added always.

snjeza avatar Aug 30 '22 01:08 snjeza

will be added automatically?

Right!

Will this happen for existing project, new project, or both? Will it apply For maven based project, no-build tool project, or both?

It should be added always.

Please bear with me as I cannot afford to mess up with my vs code setup.

So, you are saying that this download:

https://github.com/snjeza/vscode-test/raw/master/java-1.10.0.vsix

Is an updated version for vscode and will fix the problem of Java Build Status spinning forever.

But what will happen to my current stable vs code setup? will it override my current vs code installation?

tarekahf avatar Aug 30 '22 04:08 tarekahf

But what will happen to my current stable vs code setup? will it override my current vs code installation?

@tarekahf you can wait for the stable VS Code 1.10.0 release - https://github.com/redhat-developer/vscode-java/pull/2648

snjeza avatar Aug 30 '22 15:08 snjeza