mfussenegger / nvim-jdtls

Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
GNU General Public License v3.0
1.09k stars 62 forks source link

Spawning language server with cmd: `java-lsp.sh` failed with error message: Unknown system error -8: Uknown system error -8 #362

Closed mTvare6 closed 1 year ago

mTvare6 commented 1 year ago

LSP client configuration

in init.lua:

vim.api.nvim_exec([[au FileType java lua require('jdtls').start_or_attach({cmd = {'java-lsp.sh'}, on_attach = on_attach})
]], false)

in java-lsp.sh(according to commits before b07dd81):

JAR="$HOME/.config/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar"
GRADLE_HOME=$HOME/gradle $JAVA_HOME/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 \
  -jar $(echo "$JAR") \
  -configuration "$HOME/.config/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/config_mac" \
  -data "${1:-$HOME/workspace}" \
  --add-modules=ALL-SYSTEM \
  --add-opens java.base/java.util=ALL-UNNAMED \
  --add-opens java.base/java.lang=ALL-UNNAMED

Eclipse.jdt.ls version

1.2.0

Steps to Reproduce

When opening any java file through neovim, regardless of other conditions, it quits with the above given error. On running the command 'java-lsp.sh' outside neovim, opens the lsp normally. image

Expected Result

Normal functioning of the language server, as when it is opened outside neovim. It is note-worthy that I haven't used nvim-jdtls since nvim 0.5.0 and opening it after a long while, gives the above result.

Actual Result

image

mfussenegger commented 1 year ago

Can you check if there's anything in the log files? I've never seen the "unknown system error -8" before.

mTvare6 commented 1 year ago

Can you check if there's anything in the log files? I've never seen the "unknown system error -8" before.

Once the LSP server quits, on checking the lsp.log file, nothing new is added, so it looks like nothing new is being added. The lop system seems to work anyway, for example clangd gives output

mfussenegger commented 1 year ago

Can you try deleting your data directory? See https://github.com/mfussenegger/nvim-jdtls#the-client-exits-with-an-error--eclipsejdtls-stopped-working

mTvare6 commented 1 year ago

image On running the in built command, it wouldn't run, although after manual deletion the error persists.

And on checking the logs by setting different debug types, the following was observed

[START][2022-11-13 18:01:45] LSP logging initiated
[INFO][2022-11-13 18:01:45] .../lua/vim/lsp.lua:1814    "exit_handler"  {}
[START][2022-11-13 18:04:30] LSP logging initiated
[INFO][2022-11-13 18:04:30] .../vim/lsp/rpc.lua:661 "Starting RPC client"   {  args = {},  cmd = "java-lsp.sh",  extra = {}}
mfussenegger commented 1 year ago

Not sure what could cause this. In any case it has something to do with your installation, and with eclipse.jdt.ls, not really with this plugin.

Maybe you can try to re-install it, and either use the new jdtls start script or write out the long cmd as it is documented in the readme.