nvim-lsp-installer icon indicating copy to clipboard operation
nvim-lsp-installer copied to clipboard

jdtls does not work

Open aman7000 opened this issue 3 years ago • 18 comments

Problem description

Java lsp does not work

Why do you think this is an issue with nvim-lsp-installer?

getting error on java file, instead of lsp loading. Error:- Client 1 quit with exit code 13 and signal 0

Neovim version (>= 0.7)

NVIM 0.7.0

Operating system/version

Mac

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • [ ] Yes

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

  • [X] Yes

Affected language servers

java

Steps to reproduce

  1. Install java server with :LspInstall java
  2. Open java file to see the error

Actual behavior

error comes: Client 1 quit with exit code 1 and signal 0

Expected behavior

java Lsp should work

LspInfo

Language client log: /Users/amansingh/.cache/nvim/lsp.log
 Detected filetype:   java
 
 0 client(s) attached to this buffer: 
 
 Other clients that match the filetype: java
 
 Config: jdtls
 	filetypes:         java
 	root directory:    /Users/amansingh/workspace/java/nbfc
 	cmd:               /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/home/jre/bin/java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -Xms1g -Xmx2G -javaagent:/Users/amansingh/.local/share/nvim/lsp_servers/jdtls/lombok.jar --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar /Users/amansingh/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration /Users/amansingh/.local/share/nvim/lsp_servers/jdtls/config_mac -data /Users/amansingh/workspace/nbfc
 	cmd is executable: false (checked by nvim-lsp-installer)
 	                   Make sure you have set up nvim-lsp-installer (:h nvim-lsp-installer-quickstart)
 	autostart:         true
 	custom handlers:   language/status, textDocument/rename, workspace/applyEdit, textDocument/codeAction
 
 Configured servers list: jsonls, tsserver, tailw

LspLog

No response

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.7.0
  - OK: **Go**: `go version go1.18 darwin/arm64`
  - OK: **cargo**: `cargo 1.61.0 (a028ae42f 2022-04-29)`
  - WARNING: **luarocks**: not available
  - OK: **Ruby**: `ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]`
  - OK: **RubyGem**: `3.0.3.1`
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `8.1.0`
  - OK: **node**: `v16.13.0`
  - OK: **python3**: `Python 3.9.13`
  - OK: **pip3**: `pip 22.1.1 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)`
  - OK: **javac**: `javac 11.0.15`
  - OK: **java**: `Ok`
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - OK: **curl**: `curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1`
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 12. Remaining: 48. Limit: 60. Reset: Wed Jun  8 21:53:23 2022.

Screenshots or recordings

Screen Shot 2022-06-08 at 9 13 13 PM

aman7000 avatar Jun 08 '22 15:06 aman7000

Hello! It seems like you have the JAVA_HOME environment variable defined. This variable is used to locate the user's installation of Java. Are you sure it's pointing to a valid installation? If it's not, you probably want to unset it altogether (if java is already in your PATH), or set it to a valid directory

williamboman avatar Jun 08 '22 22:06 williamboman

Hi,

After unsetting JAVA_HOME. Still getting the same error message. Java is in path

Output of java -version :- openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Output of :LspInfo

Language client log: /Users/amansingh/.cache/nvim/lsp.log Detected filetype: java

0 client(s) attached to this buffer:

Other clients that match the filetype: java

Config: jdtls filetypes: java root directory: /Users/amansingh/workspace/java/nbfc cmd: java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -Xms1g -Xmx2G -javaagent:/Users/amansingh/.local/share/nvim/lsp_servers/jdtls/lombok.jar --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar /Users/amansingh/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration /Users/amansingh/.local/share/nvim/lsp_servers/jdtls/config_mac -data /Users/amansingh/workspace/nbfc cmd is executable: false (checked by nvim-lsp-installer) Make sure you have set up nvim-lsp-installer (:h nvim-lsp-installer-quickstart) autostart: true custom handlers: workspace/applyEdit, textDocument/codeAction, language/status, textDocument/rename

Configured servers list: vimls, svelte,

Regards,

Aman S Bains Jaguar Software India ORR, Hebbal, Bangalore, Karnataka 560032 Mob: +91 9666107000 www.JaguarSoftwareIndia.com http://www.jaguarsoftwareindia.com

GO GREEN*:* Please do not take printout of this mail unless it is unavoidable.

On Thu, 9 Jun 2022 at 04:06, William Boman @.***> wrote:

Hello! It seems like you have the JAVA_HOME environment variable defined. This variable is used to locate the user's installation of Java. Are you sure it's pointing to a valid installation? If it's not, you probably want to unset it altogether (if java is already in your PATH), or set it to a valid directory

— Reply to this email directly, view it on GitHub https://github.com/williamboman/nvim-lsp-installer/issues/763#issuecomment-1150481036, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADA2VTQSUOSRJFAX53PPIL3VOEOAVANCNFSM5YHAMOFQ . You are receiving this because you authored the thread.Message ID: @.***>

aman7000 avatar Jun 09 '22 07:06 aman7000

Have you checked the :LspLog logs?

williamboman avatar Jun 09 '22 12:06 williamboman

:LspLog is fine

aman7000 avatar Jun 11 '22 10:06 aman7000

[START][2022-06-09 13:13:11] LSP logging initiated [START][2022-06-09 13:15:29] LSP logging initiated [START][2022-06-09 13:17:03] LSP logging initiated [START][2022-06-09 13:22:09] LSP logging initiated [START][2022-06-09 13:28:06] LSP logging initiated [START][2022-06-09 13:24:22] LSP logging initiated [START][2022-06-10 18:24:19] LSP logging initiated [START][2022-06-10 18:40:07] LSP logging initiated [START][2022-06-10 18:47:30] LSP logging initiated [START][2022-06-11 13:17:27] LSP logging initiated [START][2022-06-11 13:45:52] LSP logging initiated [START][2022-06-11 13:46:05] LSP logging initiated [START][2022-06-11 13:46:33] LSP logging initiated [START][2022-06-11 15:21:48] LSP logging initiated

aman7000 avatar Jun 11 '22 10:06 aman7000

java lsp Just doesn't work ...

aman7000 avatar Jun 11 '22 10:06 aman7000

Try setting a lower log level to capture more information in :LspLog (see :h lspconfig-logging for how to do so). Do you see anything that could be helpful in your troubleshooting then?

williamboman avatar Jun 12 '22 14:06 williamboman

I have the same problem. I don't see any errors being printed to the logs anymore (even witht the log level set to "info"), but I remember it used to say SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder after the server exited.

Bear-03 avatar Jun 12 '22 19:06 Bear-03

I want to chime on this as well, after LspInstall jdtls today i saw the same issue, i believe this is likely JDTLS itself, being very unstable, possibly the most unstable language server i have ever seen. Pretty much every time i update that it breaks something or has issues starting, or you have to delete th workspaces folder to make it work, it is very, very bad.

Now what i propose is for people to use the milestone builds - for example i just downgraded to this one - https://download.eclipse.org/jdtls/milestones/1.9.0/.

I think LSP insatller should consider using milestone builds instead of snapshots, those seem to be more stable (better tested maybe, i can not really confirm).

Note: Going through their commits, i noticed that they might be trying to migrate to java17, maybe already have, which means that the next release will mandate 17 and may not even work on 11. But nobody really communicates that with the community.

asmodeus812 avatar Jun 13 '22 13:06 asmodeus812

Is there any way to downgrade via nvim-lsp-installer itself or would I have to do it manually?

Bear-03 avatar Jun 13 '22 13:06 Bear-03

I don't think so, downgrade is rather simple, download the tar ball and unzip the contents to the data folder - /home/{user}/.local\share\nvim\lsp_servers\jdtls . I suggest delete everything in that folder first, without lombok (if you are using it, since milestone builds don't come with lombok i think, or you can also update lombok manually if you choose to do so) Then paste the contents of the archive. Avoid calling LspInstall jdtls or LspUpdate etc.

asmodeus812 avatar Jun 13 '22 13:06 asmodeus812

Alright, thanks!

Bear-03 avatar Jun 13 '22 14:06 Bear-03

You can specify version via LspInstall, like so:

:LspInstall [email protected]

williamboman avatar Jun 13 '22 15:06 williamboman

As for using milestone releases instead of snapshots - I think that makes sense! The reasons snapshots are currently used is because that's what the vscode plugin does. It seems like they don't provide the same endpoints to fetch the latest milestone, which they provide for snapshots, so that complicates things a bit.

williamboman avatar Jun 19 '22 16:06 williamboman

You don't have to go all the way to 1.9. :LspInstall [email protected] works.

s1n7ax avatar Jun 27 '22 03:06 s1n7ax

@williamboman Is it possible to have versions? something like [email protected] in the config and auto install the specific version. At the moment it complains because the LS doesn't exist.

s1n7ax avatar Jun 27 '22 03:06 s1n7ax

You can do something like

require("nvim-lsp-installer").setup {
    ensure_installed = { "[email protected]" },
    automatic_installation = { exclude = { "jdtls" } }
}

williamboman avatar Jun 27 '22 10:06 williamboman

Same issue, switching to java 17 fixed it. I'm not that versed in java version management chicanery, can I tell jdtls to use one version so I'd keep the rest of my system on another?

RaafatTurki avatar Jul 10 '22 21:07 RaafatTurki