redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.07k stars 431 forks source link

Error occurred in initializing language server when opening Multi Module Maven Project in vscode #2806

Open tarekahf opened 1 year ago

tarekahf commented 1 year ago

Type: Bug

I checked out a Maven Project with multiple modules (main POM.xml and nested project with POM.xml files) and was able to open the project and compile it correctly using Eclipse.

However, if I check out the same project in another folder and open the project in vscode I will get an error while building the project while it is still loading. I even tried opening the same project folder that was built successfully in Eclipse, but I get the same error in vs code.

In the vscode status bar, I see the message "Error occurred in initializing language server". Then if I click on the thumbs-own icon, I see two log files which are attached below:

.log client.log

Extension version: 0.25.6 VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T04:27:29.066Z) OS version: Windows_NT x64 10.0.19042 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz (4 x 2904)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|15.88GB (2.09GB free)| |Process Argv|--crash-reporter-id 18a83e5c-0407-4a13-8d26-c6c9570eedd6| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 pyindex848:30577860 nodejswelcome1:30587005 fc301958:30595537 282f8724:30602487 gswce1:30612156 3d0df643:30613357 dbltrim-noruby:30604474 f6dab269:30613381 ```
Extensions (37) Extension|Author (truncated)|Version ---|---|--- vscode-tomcat|ada|0.12.1 Bookmarks|ale|13.3.1 atlascode|atl|2.10.12 vscode-log-viewer|ber|0.12.2 vscode-eslint|dba|2.2.6 xml|Dot|2.5.1 vscode-html-css|ecm|1.13.1 packsharp|els|2.3.2 open-lnk|Enk|0.0.1 dotnet-test-explorer|for|0.7.8 vscode-nuget-package-manager|jmr|1.1.6 svn-scm|joh|2.15.5 json-escaper|jos|1.1.2 vscode-JS-CSS-HTML-formatter|lon|0.2.3 csharp|ms-|1.25.2 data-workspace-vscode|ms-|0.3.0 mssql|ms-|1.16.0 sql-bindings-vscode|ms-|0.3.0 sql-database-projects-vscode|ms-|0.19.0 powershell|ms-|2022.11.0 sqltools|mtx|0.26.0 sqltools-driver-mssql|mtx|0.3.0 java-string-literal-tools|pol|1.0.1 fabric8-analytics|red|0.3.6 java|red|1.12.0 vscode-commons|red|0.0.6 vscode-yaml|red|1.10.1 LiveServer|rit|5.7.9 vscode-fileutils|sle|3.5.0 code-spell-checker|str|2.11.0 intellicode-api-usage-examples|Vis|0.2.6 vscodeintellicode|Vis|1.2.29 vscode-java-debug|vsc|0.46.0 vscode-java-dependency|vsc|0.21.1 vscode-java-pack|vsc|0.25.6 vscode-java-test|vsc|0.37.1 vscode-maven|vsc|0.39.2
snjeza commented 1 year ago

@tarekahf Could you try the Pre-Release version of Language Support for Java(TM) by Red Hat?

tarekahf commented 1 year ago

@tarekahf Could you try the Pre-Release version of Language Support for Java(TM) by Red Hat?

@snjeza could you please guide me on how to install the Pre-Release version of Language Support for Java(TM) by Red Hat?

tarekahf commented 1 year ago

@snjeza don't worry... I figured out!

tarekahf commented 1 year ago

@snjeza I tried the Pre-Release by installing it using the related .vsix and it didn't solve the problem. I made sure to update the entire Java Extension Pack from the Extensions View, still not working. I am getting exactly the same behavior and error I mentioned above, and I see two log files when I click on the thumbs-down icon on the status bar, they are the same files I attached to this thread.

snjeza commented 1 year ago

could you please guide me on how to install the Pre-Release version of Language Support for Java(TM) by Red Hat?

prerel

snjeza commented 1 year ago

@tarekahf You can also try to set

"java.import.generatesMetadataFilesAtProjectRoot": true,

and clean the workspace using Java: Clean the Java Language Server Workspace.

tarekahf commented 1 year ago

Thanks a lot @snjeza I did switch to the pre-release version but this didn't solve my problem.

I am now trying to open a previous Maven Based Project that I am sure was working. I will then see if the problem is due to vs code update or due to the project itself!

snjeza commented 1 year ago

@tarekahf Could you try to find the following files in your project tree: .project .classpath .settings

tarekahf commented 1 year ago

Now, I tried to open another project that I am 100% sure was working before (a small maven project with a single POM.xml), and I see the following in the Language Server Output:

WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
[Info  - 6:25:29 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Error - 6:27:20 PM] Nov 17, 2022, 6:27:20 PM InterruptedException
null
java.lang.InterruptedException
    at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:35)
    at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:978)
    at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:356)
    at org.eclipse.core.runtime.jobs.Job.join(Job.java:531)
    at org.eclipse.jdt.ls.core.internal.syntaxserver.SyntaxLanguageServer.exit(SyntaxLanguageServer.java:171)
    at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.run(ParentProcessWatcher.java:58)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

[Info  - 6:27:21 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Info  - 6:28:43 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
[Error - 6:30:16 PM] Nov 17, 2022, 6:30:16 PM InterruptedException
null
java.lang.InterruptedException
    at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:35)
    at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:978)
    at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:356)
    at org.eclipse.core.runtime.jobs.Job.join(Job.java:531)
    at org.eclipse.jdt.ls.core.internal.syntaxserver.SyntaxLanguageServer.exit(SyntaxLanguageServer.java:171)
    at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.run(ParentProcessWatcher.java:58)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

[Info  - 6:30:17 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Info  - 6:31:40 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Error - 6:32:58 PM] Nov 17, 2022, 6:32:58 PM InterruptedException
null
java.lang.InterruptedException
    at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:35)
    at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:978)
    at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:356)
    at org.eclipse.core.runtime.jobs.Job.join(Job.java:531)
    at org.eclipse.jdt.ls.core.internal.syntaxserver.SyntaxLanguageServer.exit(SyntaxLanguageServer.java:171)
    at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.run(ParentProcessWatcher.java:58)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

[Info  - 6:32:59 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
[Info  - 6:34:18 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Info  - 6:35:34 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
[Error - 6:36:59 PM] Nov 17, 2022, 6:36:59 PM InterruptedException
null
java.lang.InterruptedException
    at org.eclipse.core.internal.jobs.Semaphore.acquire(Semaphore.java:35)
    at org.eclipse.core.internal.jobs.JobManager.join(JobManager.java:978)
    at org.eclipse.core.internal.jobs.InternalJob.join(InternalJob.java:356)
    at org.eclipse.core.runtime.jobs.Job.join(Job.java:531)
    at org.eclipse.jdt.ls.core.internal.syntaxserver.SyntaxLanguageServer.exit(SyntaxLanguageServer.java:171)
    at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.run(ParentProcessWatcher.java:58)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

[Info  - 6:37:00 PM] Connection to server got closed. Server will restart.
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign

And, the build status keeps on spinning forever (small maven project with single POM.xml).

EDIT: Could this happen (connection closed) because I am connected via Mobile Hotspot?

I remember a couple of days ago, I opened the same project with the wrong $home\.m2\settings.xml and I saw errors indicating missing dependencies. Now, I can't even reach this stage. It wasn't even compiling in Eclipse. So, I fixed settings.xml and it started compiling in Eclipse, now it is breaking in VS Code.

I will follow the instructions you mentioned above to clean the project directory and get back to you.

snjeza commented 1 year ago

small maven project with single POM.xml

@tarekahf Could you attach this project?

tarekahf commented 1 year ago

small maven project with single POM.xml

@tarekahf Could you attach this project?

@snjeza I can't, it needs VPN.

I have another one, it's public and called jar-explorer I am sure it was loading in VS code. I will try that as well. You can also find it on GitHub.

I tried a no-build tool Java project, and it works fine. The problem now is only with Maven Projects.

tarekahf commented 1 year ago

@snjeza

Could you try to find the following files in your project tree: .project .classpath .settings

  • exit VS Code
  • remove all the mentioned files in all your directories
  • restart VS Code

I duplicated of the folder used to run maven build from Eclipse where it was successful. I deleted the files you mentioned and opened the new project folder in vs code. I still see the build icon spinning forever, and I see the following in the Language Server Output:

WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Info  - 7:18:57 PM] Connection to server got closed. Server will restart.
[Error - 7:18:57 PM] Request textDocument/inlayHint failed.
Error: Connection got disposed.
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1043253)
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890249)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890437)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:964069)
    at t (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:888551)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at Q (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1032392)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at _.fireClose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057085)
    at Socket.<anonymous> (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057870)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)
[Error - 7:18:57 PM] Request textDocument/semanticTokens/full failed.
Error: Connection got disposed.
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1043253)
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890249)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890437)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:964069)
    at t (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:888551)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at Q (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1032392)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at _.fireClose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057085)
    at Socket.<anonymous> (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057870)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)
[Error - 7:18:57 PM] Request textDocument/inlayHint failed.
Error: Connection got disposed.
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1043253)
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890249)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890437)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:964069)
    at t (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:888551)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at Q (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1032392)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at _.fireClose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057085)
    at Socket.<anonymous> (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057870)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)
[Error - 7:18:57 PM] Request textDocument/inlayHint failed.
Error: Connection got disposed.
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1043253)
    at Object.dispose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890249)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:890437)
    at b.handleConnectionClosed (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:964069)
    at t (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:888551)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at Q (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1032392)
    at i.invoke (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1044879)
    at s.fire (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1045640)
    at _.fireClose (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057085)
    at Socket.<anonymous> (<path-to-user-home>\.vscode\extensions\redhat.java-1.13.2022111603\dist\extension.js:2:1057870)
    at Socket.emit (node:events:526:28)
    at Pipe.<anonymous> (node:net:687:12)
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign

And I see the following in the Terminal, the Build Output:

890fffbb Importing Maven project(s): Importing Maven project(s) - Importing project <project-name> [337/1000]
b59e3053 Shutdown...: 0%  [0/1000]

It's stuck for 5 minutes no progress.

snjeza commented 1 year ago

@tarekahf can try to set

"java.import.generatesMetadataFilesAtProjectRoot": true,

in settings.json

tarekahf commented 1 year ago

can try to set

"java.import.generatesMetadataFilesAtProjectRoot": true,

in settings.json

  • clean the workspace using Java: Clean the Java Language Server Workspace
  • exit VS Code
  • remove - .project .classpath .settings in all your directories
  • restart VS Code

@snjeza

This is a detailed update...

First, I restarted my laptop to avoid any issues related to memory and conflicts with other tasks. This step made things better for sure. Also, I made sure to connect to WiFi.

I opened this project https://github.com/javalite/jar-explorer using vs code and it opened correctly and compiled properly without any issues. I didn't use this config with jar-explorer:

"java.import.generatesMetadataFilesAtProjectRoot": true,

When I opened the huge multi-module maven project in vs code, I noticed if I use

"java.import.generatesMetadataFilesAtProjectRoot": true,

It will eventually import the project and I can see them in the Java Project and Maven Views, but the build status icon on the status bar was spinning forever. Also, I saw the errors Connection to server got closed. Server will restart. repeating every 2-3 minutes.

I tried again without the config mentioned above, and I can say it's about the same, and probably a bit worse (without). I think the main problem is that the project is relatively huge, and there is something causing the Language Server to restart every 2-3 minutes. I think what is happening if there are enough CPU/memory resources to compile the project to a degree where it allows the views on the left side (Java Projects and Maven) to show, in that case, I will see the project loading, but the build status is still running and will spin forever in both cases.

See the attached Language Server Output log for both cases, with the config Language Server Output-22-11-18 10-02am.log and without the config Language Server Output-22-11-18 11-50am.log.

Mind you that I tried to compile using mvn clean install on the project after removing eclipse files, a few modules compiled successfully and others failed. I think this is because of JRE version config was removed when I removed the eclipse files. I also ran mvn clean install outside eclipse on the project folder that is compiling successfully in eclipse, and I got the same errors below:

[ERROR] Failed to execute goal org.codehaus.mojo:rmic-maven-plugin:1.3:rmic (rmi-compile) on project adaptersansa: Error while executing the RMI compiler.:  Built-in RMIC compiler not available in JDK9. Add a dependency on org.glassfish.corba:rmic to the plugin. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :adaptersansa

In eclipse, to build the project, I must configure JRE properly and skip tests when running the maven build process. I think the classpath/JRE needs to be configured in POM.xml properly for the project to compile successfully without using eclipse. I am not sure if this is part of the problem.

Please let me know if you have any idea how to solve the problem of the Language Server getting restarted every 2-3 minutes.

Language Server Output-22-11-18 10-02am.log Language Server Output-22-11-18 11-50am.log

snjeza commented 1 year ago

Please let me know if you have any idea how to solve the problem of the Language Server getting restarted every 2-3 minutes.

@tarekahf Could you show all your VS Code extensions?

I think what is happening if there are enough CPU/memory resources to compile the project to a degree where it allows the views on the left side (Java Projects and Maven) to show, in that case, I will see the project loading, but the build status is still running and will spin forever in both cases.

Could you attach your settings.json?

I think the classpath/JRE needs to be configured in POM.xml

<properties>
...
                <maven.compiler.source>1.8</maven.compiler.source> <!-- your JDK version 1.8, 11, 17...-->
                <maven.compiler.target>1.8</maven.compiler.target>
...
</properties>
tarekahf commented 1 year ago

@snjeza Please find below list of extensions:

Extensions (37) Extension|Author (truncated)|Version ---|---|--- vscode-tomcat|ada|0.12.1 Bookmarks|ale|13.3.1 atlascode|atl|2.10.12 vscode-log-viewer|ber|0.12.2 vscode-eslint|dba|2.2.6 xml|Dot|2.5.1 vscode-html-css|ecm|1.13.1 packsharp|els|2.3.2 open-lnk|Enk|0.0.1 dotnet-test-explorer|for|0.7.8 vscode-nuget-package-manager|jmr|1.1.6 svn-scm|joh|2.15.5 json-escaper|jos|1.1.2 vscode-JS-CSS-HTML-formatter|lon|0.2.3 csharp|ms-|1.25.2 data-workspace-vscode|ms-|0.3.0 mssql|ms-|1.16.0 sql-bindings-vscode|ms-|0.3.0 sql-database-projects-vscode|ms-|0.19.0 powershell|ms-|2022.11.0 sqltools|mtx|0.26.0 sqltools-driver-mssql|mtx|0.3.0 java-string-literal-tools|pol|1.0.1 fabric8-analytics|red|0.3.6 java|red|1.12.0 vscode-commons|red|0.0.6 vscode-yaml|red|1.10.1 LiveServer|rit|5.7.9 vscode-fileutils|sle|3.5.0 code-spell-checker|str|2.11.0 intellicode-api-usage-examples|Vis|0.2.6 vscodeintellicode|Vis|1.2.29 vscode-java-debug|vsc|0.46.0 vscode-java-dependency|vsc|0.21.1 vscode-java-pack|vsc|0.25.6 vscode-java-test|vsc|0.37.1 vscode-maven|vsc|0.39.2

User and Workspace settings.json are attached below:

user settings.json.txt workspace settings.json.txt

Regarding the maven compile issue form command line, I did the following:

set JAVA_HOME=path/to/jdk 1.8
set path=path/to/jdk1.8/bin;%path%
mvn install

and the build was successful. I will repeat the maven compile process by changing POM.xml instead changing the environment variables. If you have any feedback please let me know.

Update Regarding the multi-module project issue opening in VS Code:

I tried to follow a recommendation to run the Extensions Bisect process from vs code, and I stopped since it appeared it will take a long time. It seems the bisect process disabled all extensions and then it turned them back on. I reloaded the project and left it for one hour. I came back it found out that everything was loaded and the Language Server was in a good state with a thumbs-up icon. I am now able to use the navigation section on the left to work with Java Project and Maven Views. I am not sure if disabling all extensions and enabling them back fixed some issues. I will try reloading the project again and find out more. Mind you that the config "java.import.generatesMetadataFilesAtProjectRoot": true was active during this project load.

I then reloaded the project using the command to clean Java Language Server Workspace, and I see the error "Error occurred in initializing Language Server" after a couple of minutes.

Again, I ran the Extensions Bisect command and stopped it by clicking "Bad" then the project was reloaded and all look good. I see the Java Project and Maven views and run maven commands from vs code. And, the strange thing is that it was relatively fast while loading the project.

I think the problem is caused by some extensions since if all extensions are disabled and enabled (after using Extensions Bisect), then the project will load.

I appreciate your help!

tarekahf commented 1 year ago

@snjeza today, I opened my laptop by resuming it from sleep mode. All applications were closed and started vs code, and the project loaded successfully without any problems. It took about 3-4 minutes to load, but it was successful. Also, the project is compiling successfully only after I set the PATH and JAVA_HOME to point to JDK 1.8.

I still don't know if the problem is solved and am not sure how it is solved. I'll keep monitoring it and provide updates when needed.

Please let me know if you have any feedback.

Note: the setting "java.import.generatesMetadataFilesAtProjectRoot": true is still active, and using the pre-release of Language Support for Java (TM) by Red Hat.

tarekahf commented 1 year ago

After monitoring this issue over several days, I can say the following:

You can close this ticket now and I will create a more focused issue when I come across an apparent problem.