Skip to content

Work fine for me but have a error info  #363

Closed as duplicate
Closed as duplicate

Description

@zaiqiang-dong

dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: in function 'handler'
...m-linux-x86_64/share/nvim/runtime/lua/vim/lsp/client.lua:679: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

Error executing vim.schedule lua callback: ...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:28:
dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: in function 'handler'
...m-linux-x86_64/share/nvim/runtime/lua/vim/lsp/client.lua:679: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
[C]: in function 'error'
...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:28: in function 'error_handler'
...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:74: in function 'handler'
...m-linux-x86_64/share/nvim/runtime/lua/vim/lsp/client.lua:679: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

Activity

  1. changed the title [-]Error info[/-] [+]Work fine for me but have a error info [/+] on Mar 28, 2025
  2. zaiqiang-dong commented on Mar 28, 2025

    @zaiqiang-dong
    Author

    config as bellow:

    	{ "nvim-java/nvim-java" },
    	{
    		"neovim/nvim-lspconfig",
    		event = "VeryLazy",
    		dependencies = { "williamboman/mason-lspconfig.nvim" },
    		config = function()
    			vim.lsp.set_log_level("off")
    
    			-- IMPORTANT: make sure to setup neodev BEFORE lspconfig
    			require("neodev").setup({
    				-- add any options here, or leave empty to use the default settings
    			})
                     ...............
                     	require("java").setup({
    				jdk = {
    					auto_install = false,
    				},
    				root_markers = {
    					".classpath",
    					"pom.xml",
    					"mvnw",
    					"gradlew",
    				},
    			})
    
    			local bdles = {}
    			vim.list_extend(
    				bdles,
    				vim.split(vim.fn.glob("~/.local/share/nvim/mason/packages/vscode-java-decompiler/server/*.jar"), "\n")
    			)
    
    			vim.notify(bdles[1], vim.log.levels.INFO)
    			local is_aosp = false
    			local is_maven = false
    			local is_gradle = false
    			if vim.fs.root(0, { ".classpath" }) ~= nil then
    				is_aosp = true
    				vim.notify("aosp", vim.log.levels.INFO)
    			elseif vim.fs.root(0, { "pom.xml", "mvnw" }) ~= nil then
    				is_maven = true
    				vim.notify("maven", vim.log.levels.INFO)
    			elseif vim.fs.root(0, { "gradlew" }) ~= nil then
    				is_gradle = true
    				vim.notify("gradlew", vim.log.levels.INFO)
    			end
    
    			require("lspconfig").jdtls.setup({
    				on_attach = on_attach,
    				root_dir = vim.fs.root(0, { ".classpath", "pom.xml", "mvnw", "gradlew" }),
    				init_options = {
    					bundles = bdles,
    					settings = {
    						java = {
    							autobuild = {
    								enabled = false,
    							},
    							import = { -- <- this
    								maven = {
    									enabled = is_maven,
    								},
    								gradle = {
    									enabled = is_gradle,
    									wrapper = {
    										enabled = is_gradle,
    									},
    								},
    							},
    							decompiler = {
    								fernflower = {
    									enabled = true,
    								},
    							},
    							contentProvider = {
    								preferred = "fernflower",
    							},
    						},
    					},
    				},
    			})
    
    
    
    
  3. Karmenzind commented on May 10, 2025

    @Karmenzind

    Same error here. I'm using mason 2.0 and the latest nvim-java.
    Configured as follows:

    require("mason").setup({
        PATH = "append",
        registries = { "github:nvim-java/mason-registry", "github:mason-org/mason-registry" },
        ui = { check_outdated_packages_on_open = false },
        -- log_level = vim.log.levels.DEBUG,
    })
    
    require("java").setup({ jdk = { auto_install = false }})
    
    require("mason-lspconfig").setup({
        ensure_installed = { "lua_ls", "pyright", "vimls", "bashls", "marksman", "gopls", "jdtls" },
        -- automatic_enable = true,
    })
    
    
    vim.lsp.enable({
        "jdtls",
    })
    vim.lsp.config("*", { capabilities = require("cmp_nvim_lsp").default_capabilities() })
    

    I tried to disable the debug feature (I only need code review for Java) with 👇 but failed:

    require("java").setup({
        java_debug_adapter = {
            enable = false,
        },
        notifications = {
            dap = false,
        },
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions