spring-boot.nvim icon indicating copy to clipboard operation
spring-boot.nvim copied to clipboard

spring-boot LS does not work and does not show up in lsp logs

Open keen-dot-dev opened this issue 6 months ago • 9 comments

Issue:

:checkhealth vim.lsp command never shows spring-boot LS and suggestions do not work in application.yml/application.properties.

Description:

My setup:

  1. vscode-spring-boot-tools and jdtls installed with Mason.
  2. nvim-jdtls setup with ftplugin.
  3. lazy.nvim configuration for nvim-jdtls and spring-boot.nvim:
{
    "mfussenegger/nvim-jdtls",
    dependencies = { "mfussenegger/nvim-dap" }
},
{
    "JavaHello/spring-boot.nvim",
    dependencies = { "mfussenegger/nvim-jdtls" },
    lazy = true,
    opts = {}
}
  1. My ftplugin config for java and yaml:
local data_path = "..." -- path to constructed data directory for the project
local jdtls_bin = "..." -- path to JDTLS binary
local lombok_jar = "..." -- path to Lombok jar
local bundles = {}
vim.list_extend(bundles, require("spring_boot").java_extensions())
vim.list_extend(bundles, vim.split(vim.fn.glob(".../vscode-java-test/server/*.jar"), "\n"))
vim.list_extend(bundles, vim.split(vim.fn.glob(".../java-debug/com.microsoft.java.debug.plugin/target/*.jar"), "\n"))
jdtls.start_or_attach({
    cmd = {
        jdtls_bin,
        "--jvm-arg=-javaagent:" .. lombok_jar,
        "-data", data_path
    },
    root_dir = vim.fs.dirname(vim.fs.find({ "gradlew", ".git", "mvnw" }, { upward = true })[1]),
    init_options = { bundles = bundles }
})
  1. The jdtls LS works well, completion in java files is present, no issues. The :checkhealth vim.lsp command always show it properly. java-test setup and debugging also work fine.

The problem:

  1. The spring-boot LS never shows up in :checkhealth vim.lsp or lsp.log .
  2. Sometimes when I open java or yaml file I get the message Spring Boot LS is not installed. (I can fix this one by manually providing ls_path to the opts in spring-boot.nvim configuration, but it looks like something else is wrong)

keen-dot-dev avatar Jul 19 '25 19:07 keen-dot-dev

{
  "JavaHello/spring-boot.nvim",
  ft = {"java", "yaml", "jproperties"},
  dependencies = {
    "mfussenegger/nvim-jdtls", 
  },
  ---@type bootls.Config
  opts = {}
}

Try this configuration

JavaHello avatar Jul 20 '25 09:07 JavaHello

@JavaHello, thank you for your response!

This configuration also did not work, unfortunately. When yml file is opened, there are no errors. But the :checkhealth vim.lsp still only shows JDTLS (started by ftplugin/yaml.lua) and yamlls if I install it. application.yml completion also does not work.

However, if I provide ls_path to the opts table - there is strange behavior:

  • Opening java files works without issues, but the spring-boot LS is still not present in :checkhealth vim.lsp.
  • But if I open yml file - I get an error: Client spring-boot quit with exit code 1 and signal 0. Check log for errors: /home/user/.local/state/nvim/lsp.log. And there is an error in log: [ERROR][2025-07-20 13:15:10] ...p/_transport.lua:36 "rpc" "/usr/lib/jvm/java-21-openjdk/bin/java" "stderr" "Error: Could not find or load main class org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp\nCaused by: java.lang.ClassNotFoundException: org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp\n"

keen-dot-dev avatar Jul 20 '25 10:07 keen-dot-dev

If you specify the ls_path directory, make sure there is a lib directory under ls_path, which contains the dependent jar packages

JavaHello avatar Jul 23 '25 04:07 JavaHello

@JavaHello, just double-checked it, confirmed that the lib directory with jar packages is present under the ls_path I specified. This path leads to vscode-spring-boot-tools installed by mason (.../mason/packages/vscode-spring-boot-tools/extension/language-server), which I expected to be automatically resolved by the plugin, but sometimes it fails. But even when it doesn't - appication.yml completions do not work, and spring-boot LS still doesn't log anything.

keen-dot-dev avatar Jul 24 '25 10:07 keen-dot-dev

@JavaHello please provide solution for this issue

Kabil777 avatar Jul 29 '25 16:07 Kabil777

@keen-dot-dev I was also getting the Spring Boot LS is not installed error when opening up a java file. I solved it by simply installing vscode-spring-boot-tools through Mason.

Did you end up fixing that issue in particular?

goldeneas avatar Sep 03 '25 09:09 goldeneas

@goldeneas unfortunately, installing vscode-spring-boot-tools using Mason didn't help. So far, I did not find the solution or the root cause of my problem.

keen-dot-dev avatar Sep 04 '25 16:09 keen-dot-dev

I've figured out to configure nvim-java instead of using spring-boot.nvim directly. So there's a suggested config in nvim-java docs where spring-boot-tools version 1.55.1 is specified. Nothing worked with 1.64. After downgrading nvim-java started to work. Vscode is installing 1.64 currently.

Perhaps if you downgrade spring-boot-tools to 1.5x it should start working. Maybe spring-boot.nvim does not support 1.6x but I'm not sure.

programmador avatar Oct 12 '25 11:10 programmador

I’ve also worked with nvim-java, but since the maintainer is no longer actively maintaining it, I’m exploring a DIY setup for it.

Kabil777 avatar Oct 12 '25 14:10 Kabil777