Repository navigation
bug: No delegateCommandHandler for vscode.java.test.findTestTypesAndMethods #293
Copy link
Copy link
Closed
Labels
Milestone
Description
Did you check docs and existing issues?
- I have read all the plugin docs
- I have searched the existing issues
- I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
v0.10.1
Operating system/version
MacOS 14.4.1
Describe the bug
I have an installation of nvim-java as follows -
{
"nvim-java/nvim-java",
dependencies = {
"neovim/nvim-lspconfig",
'nvim-java/lua-async-await',
'nvim-java/nvim-java-refactor',
'nvim-java/nvim-java-core',
'nvim-java/nvim-java-test',
'nvim-java/nvim-java-dap',
'MunifTanjim/nui.nvim',
'neovim/nvim-lspconfig',
'mfussenegger/nvim-dap',
{
'JavaHello/spring-boot.nvim',
commit = '218c0c26c14d99feca778e4d13f5ec3e8b1b60f0',
},
{
'williamboman/mason.nvim',
opts = {
registries = {
'github:nvim-java/mason-registry',
'github:mason-org/mason-registry',
},
},
},
opts = {
servers = {
jdtls = {
settings = {
java = {
configuration = {
runtimes = {
{
name = "JavaSE-17",
path = "/opt/homebrew/opt/openjdk@17/bin/java",
default = true
},
{
name = "JavaSE-11",
path = "/opt/homebrew/opt/openjdk@11/bin/java",
}
}
}
},
},
},
},
setup = {
jdtls = function()
require("java").setup()
end,
},
},
},
When i attempt to run ANY java method provided by the plugin, I get the following error:
02:25:21 msg_show.lua_error JavaTestRunCurrentClass Error executing vim.schedule lua callback: ...site/pack/lazy/opt/nvim-java/lua/java/handlers/error.lua:28:
failed to run the current test class
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.test.findTestTypesAndMethods"
stack traceback:
...site/pack/lazy/opt/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
...ck/lazy/opt/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:72: in function 'handler'
.../neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
[C]: in function 'error'
...site/pack/lazy/opt/nvim-java/lua/java/handlers/error.lua:28: in function 'error_handler'
...ck/lazy/opt/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:72: in function 'handler'
.../neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
I have checked and all the plugins have been successfully downloaded, as well as jdtls, java-test and java-debug-adapter.
Steps To Reproduce
- Install v2.0.1 of nvim-java
- Open java file and attempt to run any of the java commands
Expected Behavior
Expect to see error described in the bug report.
Reacted by André Jasiskis, Maxim Reznitskiy, kitparl, M. Nabil Adani, Erlon Bié, Denis Washington and Etienne Théodore
Activity
vasitzin commentedon Aug 24, 2024
I have the same issue but, the error appears also immediately after the "Configuring DAP" message.
Neovim version (nvim -v)
v0.10.1
Operating system/version
Arch Linux
heddxh commentedon Sep 7, 2024
Same here
kitparl commentedon Sep 27, 2024
I am also getting the same issue
manumoreno commentedon Oct 2, 2024
Any updates along these lines? I started seeing this error in the last 4-5 days.
erlonbie commentedon Oct 21, 2024
Same
s1n7ax commentedon Oct 22, 2024
What are the versions of
java-debug-adapter,java-test,jdtlsyou see in Mason?s1n7ax commentedon Oct 22, 2024
Your config doesn't seem to be the latest. Please try following the latest guide which is much more simpler with latest Lazy.nvim.
You can now try nvim-java inside a container with docker & devcontainer, everything will be setup for you automatically:
https://github.com/nvim-java/play-lazyvim
There is also a starter project for LazyVim, Kickstart and AstroNvim here:
https://github.com/nvim-java/nvim-java?tab=readme-ov-file#starter-configs-recommend-for-newbies
erlonbie commentedon Nov 4, 2024
I cloned Kickstart yesterday, applied the changes on these 3 commits and got the same error.Update: The issue is inside ~/.local/share/nvim (my main config). I was using NVIM_APPNAME=jkickstart.nvim nvim for kickstart.nvim inside my ~/.config for testing, it creates ~/.local/share/jkickstar.nvim, but somehow it was being interfered from my main config.
I didn't find out the origin of the problem though
radon115 commentedon Nov 16, 2024
FWIW, I was seeing this error when I had the latest jdtls installed (1.41), upon adding
github:nvim-java/mason-registryto mason registries it installed the ver.1.37 for me which fixed the issue.adibfarrasy commentedon Nov 16, 2024
I'm also getting similar issue, I can provide details:
Versions
Neovim version
v0.10.2
Operating system/version
MacOS Version 15.1
java-debug-adapterversion0.58.0
java-testversion0.40.1
note: this version seems to be locked, since everytime I try to update it will reinstall this exact version
jdtlsversionv1.37.0
JDK version
openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment JBR-17.0.12+1-1087.25-jcef (build 17.0.12+1-b1087.25)
OpenJDK 64-Bit Server VM JBR-17.0.12+1-1087.25-jcef (build 17.0.12+1-b1087.25, mixed mode)
Setup
I use kickstart.nvim, with similar setup as above but simpler:
I got this error on opening a java file, even though I already disabled the DAP
Hope this clarifies.
fromSmolsoft commentedon Dec 2, 2024
I get it too for both maven and gradle and new and existing projects.
edit:
After adding java mason registry as suggested by @radon115 error no longer appears.Despite adding registry error reappeared and is constantly shown everytime i open mason / gradle project.
Simplest steps to reproduce:
src/main/java/com/example/app/MyApp.java.../MyApp.javaConfiguring DAPfollowed bydap configuration failed ...Or open any existing project.
Tools outside nvim:
Arch Linux
Gradle 8.10.2
openjdk 21.0.5
Tools installed with nvim/ mason
NVIM v0.10.2
JDTLS v1.37.0
java-test 0.40.1
java-debug-adapter 0.58.0
lombok-nightly
openjdk-17
spring-boot-tools 1.55.1
edit2:
disabling dap doesn't work:
edit3
uninstalling java-debug-adapter via Mason doesn't work either as it is installed nex time Neovim starts.
chenxin-yan commentedon Aug 7, 2025
Can confirm that this issue still exists after updating to
nvim-java 3.0.0. Here is my config.logrusx commentedon Aug 8, 2025
Can you provide details about your system as provided in the post above yours please?
chenxin-yan commentedon Aug 8, 2025
Versions
Neovim version
v0.11.3
Operating system/version
MacOS 14.7.1
java-debug-adapter version
0.58.2
java-test version
0.40.1
jdtls version
v1.43.0
JDK version
java 21.0.6 2025-01-21 LTS
Java(TM) SE Runtime Environment (build 21.0.6+8-LTS-188)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.6+8-LTS-188, mixed mode, sharing)
Config
{ 'nvim-java/nvim-java', lazy = true, }, { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', event = 'VeryLazy', dependencies = { { 'mason-org/mason.nvim', cmd = { 'Mason' }, opts = {} }, { 'mason-org/mason-lspconfig.nvim', opts = {} }, 'WhoIsSethDaniel/mason-tool-installer.nvim', }, config = function() ... require('java').setup { jdk = { auto_install = false }, } require('lspconfig').jdtls.setup { { handlers = { -- By assigning an empty function, you can remove the notifications -- printed to the cmd ['$/progress'] = function(_, result, ctx) end, }, }, } for server_name, config in pairs(servers) do local excluded_servers = { 'tailwindcss' } local function contains(excluded, server) for _, v in ipairs(excluded) do if v == server then return true end end return false end if contains(excluded_servers, server_name) then goto continue end vim.lsp.config(server_name, config) ::continue:: end end, },Error
and
logrusx commentedon Aug 8, 2025
That's insufficient. Please look at the post and provide same details.
chenxin-yan commentedon Aug 8, 2025
Just updated the post. Thank you for helping!
logrusx commentedon Aug 8, 2025
Thank you. I'll try to reproduce it later today.
logrusx commentedon Aug 8, 2025
Can you try with the handlers in you jdtls setup contented?
I have sone recollection about that being changed in Mason.
I can't comment on details until I get to my computer but this is something you can try.
logrusx commentedon Aug 8, 2025
I've found your problem:
opts = {}causes Lazy to run lspconfig.setup which in turn calls lspconfig.jdtls.setup before nvim-java has had the chance to insert its configuration into lspconfig.jdtls.setup.logrusx commentedon Aug 8, 2025
@ShouryaRSharma this is essentially misplaced:
The jdtls table should be passed to jdtls setup.
@s1n7ax, I'm addressing you since OP is not likely to show up. This issue is a configuration issue and should be closed.
chenxin-yan commentedon Aug 8, 2025
This solved my issue. Thank you!
twpowers commentedon Aug 28, 2025
I’m still getting the same error, even though my config looks a little different. I think it’s essentially the same setup.
java.lua
lsp.lua
Error msg
I’ve tried a few different variations of the config. Ultimately, I think the error is coming from mason-lspconfig, but I can’t seem to get it right.
Captain-Ironbump commentedon Nov 7, 2025
I also have this problem
nvim-java
lsp/jdtls.lua
I am using the new lspconfig setup, because required('lspconfig') is marked depricated...
What I also see is that in mason, there is a new version for java-test (0.40.1 -> 0.43.1) and spring-boot-tools (1.55.1 -> 1.59.0).
Pressing U to upgrade these two packages, reopening neovim will install the old versions again. Not sure if this might be the issue...
Furthermore, I don't really think that this might be an error, but rather a "miss-configuration".
I had a simmilar error in case for the dap-adapter, which was resolved by providing the .vscode/launch.json, I'm just not sure what type of configuration I need to provide the findTestTypesAndMethods handler...
s1n7ax commentedon Nov 30, 2025
We have released a next beta at
v4.0.0branch. Try it and let me know if this issue still persists.https://github.com/nvim-java/nvim-java/tree/v4.0.0
Kiruel commentedon Dec 3, 2025
Just tested no more of this error when launching with v4.0.0
Captain-Ironbump commentedon Dec 3, 2025
Sorry if this is now obsolete - but, had the issue something to do with missing the step where the Test classes needed to be compiled first?
Also (not Sure if it was mentioned anywhere and is even correct, but) bundling every .jar file in the mason extension for tests will throw an error, leading to a simmilar case like this!?