Skip to content

bug: dap error in java file #103

Closed
Closed

Description

@nyjackie

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)

NVIM v0.9.4

Operating system/version

MacOS 14.2.1

Describe the bug

dap encounters error running java class file: video demonstration

Steps To Reproduce

  1. install nvim-java and necessary dependencies.
  2. run java file.

Expected Behavior

dap does not encounters error.

Activity

  1. changed the title [-]bug: lazyvim install / dap error in java file[/-] [+]bug: dap error in java file[/+] on Jan 5, 2024
  2. s1n7ax commented on Jan 6, 2024

    @s1n7ax
    Member

    I see. It's due to the file you have opened is not being a gradle/maven/eclipse project. However, sounds like this is something we should be able to debug. I will look into it. BTW, you can drag and drop videos to the issue.

  3. added this to the v2.0.0 milestone on Jan 6, 2024
  4. soeguet commented on Jan 6, 2024

    @soeguet

    This might help:

    opening up neovim will invoke and fail via mason:
    Downloading file "https://open-vsx.org/api/vscjava/vscode-java-debug/0.52.0/file/vscjava.vscode-java-debug-0.52.0.vsix"…

    but if you press i yourself this will be invoked and succeed:
    ▶ # [2/2] Downloading file "https://open-vsx.org/api/vscjava/vscode-java-debug/0.55.0/file/vscjava.vscode-java-debug-0.55.0.vsix"…

  5. VICTORVICKIE commented on Jan 7, 2024

    @VICTORVICKIE

    I am encountering similar issue, but also it seems DAP configuration fails too

    dap configuration failed
    RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
    stack traceback:
    ^I...cal/nvim-data/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
    ^I...m-data/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
    ^I...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:47: in function 'handler'
    ^I...p/apps/neovim/current/share/nvim/runtime/lua/vim/lsp.lua:1393: in function 'cb'
    ^Ivim/_editor.lua:263: in function <vim/_editor.lua:262>                                                                                                                                                                                    Press ENTER or type command to continue
    Error executing vim.schedule lua callback: ...cal/nvim-data/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:
            ...cal/nvim-data/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
            ...m-data/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:47: in function 'handler'                                                                                                                                                       ...p/apps/neovim/current/share/nvim/runtime/lua/vim/lsp.lua:1393: in function 'cb'
            vim/_editor.lua:263: in function <vim/_editor.lua:262>
    stack traceback:
            [C]: in function 'error'
            ...cal/nvim-data/lazy/nvim-java/lua/java/handlers/error.lua:28: in function 'error_handler'
            ...m-data/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:47: in function 'handler'
            ...p/apps/neovim/current/share/nvim/runtime/lua/vim/lsp.lua:1393: in function 'cb'
            vim/_editor.lua:263: in function <vim/_editor.lua:262>                       

    https://github.com/VICTORVICKIE/dotfiles/blob/main/nvim/lua/plugins/mason-lsp-config.lua

    Please suggest if the lsp plugin needs to be setup differently

  6. nyjackie commented on Jan 7, 2024

    @nyjackie
    Author

    I see. It's due to the file you have opened is not being a gradle/maven/eclipse project. However, sounds like this is something we should be able to debug. I will look into it. BTW, you can drag and drop videos to the issue.

    Thank you for looking into this. and thank you for the hard works 💪
    PS: my video size was too large 😢

  7. s1n7ax commented on Jan 7, 2024

    @s1n7ax
    Member
  8. s1n7ax commented on Jan 7, 2024

    @s1n7ax
    Member

    @VICTORVICKIE This is not related to nvim-java but you can fix it by updating mason.nvim. However, after update, you might face this issue. Please leave a comment if so.

    #104

  9. distractedpen commented on Jan 7, 2024

    @distractedpen

    @s1n7ax Yes, this issue was actually the first issue that I encountered before #104. Updating mason did fix this issue (as they added openvsx download support in version 1.9.0), but then I started getting #104.

  10. s1n7ax commented on Jan 8, 2024

    @s1n7ax
    Member

    @distractedpen are you saying that #104 is not fixed?

  11. distractedpen commented on Jan 11, 2024

    @distractedpen

    No issues anymore after updating, sorry for the confusion.

  12. marvindore commented on Jan 18, 2024

    @marvindore

    I am running Mason version v1.9.0 and have the following installed java-debug-adapter, java-test, jdtls. Dap does not automatically configure so I run the JavaDapConfig command and get the following error:

    Configuring DAP
    
    dap configuration failed
    RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
    stack traceback:
    ^I...al/share/nvim/lazy/nvim-java/lua/java/handlers/error.lua:18: in function 'error_handler'
    ^I...e/nvim/lazy/nvim-java-core/lua/java-core/utils/async.lua:32: in function 'callback'
    ^I...nvim-java-core/lua/java-core/ls/clients/jdtls-client.lua:47: in function 'handler'
    ^I....mount_nvimQLxuJP/usr/share/nvim/runtime/lua/vim/lsp.lua:1517: in function ''
    ^Ivim/_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:47: in function 'handler'
    	....mount_nvimQLxuJP/usr/share/nvim/runtime/lua/vim/lsp.lua:1517: 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:47: in function 'handler'
    	....mount_nvimQLxuJP/usr/share/nvim/runtime/lua/vim/lsp.lua:1517: in function ''
    	vim/_editor.lua: in function <vim/_editor.lua:0>
    
  13. erlonbie commented on Apr 2, 2024

    @erlonbie

    same issue as @marvindore with all plugins updated

  14. erlonbie commented on Apr 4, 2024

    @erlonbie

    @marvindore I found that in your configuration the config function should be outside dependencies. I puted:

    require('java').setup()
    require('lspconfig').jdtls.setup({})
    

    inside it and it fixed.

  15. marvindore commented on Apr 4, 2024

    @marvindore

    @erlonbie thank you so much! I didn't even noticed I misplaced that Curley brace. I haven't been working on Java lately but will try that out on my next Java project.

  16. s1n7ax commented on Apr 12, 2024

    @s1n7ax
    Member

    Please try again. If not working make the current directory a git repo and try again. Let me know the result.

    image

  17. reopened this on Apr 12, 2024
  18. manumoreno commented on Dec 17, 2024

    @manumoreno

    Hey guys, I've been facing the same issue for some time. As a result, dap is not working as expected and the springboot lsp does not start either. Any ideas on how to get around this problem?

  19. chetra-seng commented on Dec 23, 2024

    @chetra-seng

    @manumoreno I found a fix here. Try it and let me know :)
    #104 (comment)

  20. s1n7ax commented on Dec 24, 2024

    @s1n7ax
    Member

    You can now change the versions in the config itself.
    https://github.com/nvim-java/nvim-java?tab=readme-ov-file#wrench-configuration

    Note: the version combination looks broken right now for testing. I'm not sure which caused it. If you find version combination that works, let me know.

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

    bugSomething isn't working

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions