Skip to content

how to attach local tomcat , debug webapp #247

@zhangxingong

Description

@zhangxingong

Sorry, I am configuring a webapp running on a local tomcat. The following is a reference configuration but it cannot connect to tomcat. Is there any way to let dape notify jdtls to start a debugging session and connect to tomcat? Also, is the port parameter here the debugging port or the tomcat socket port?

(use-package dape
  :ensure nil
  :defer 2
  :load-path "~/.emacs.d/elpa/dape"   
  :config
  (add-to-list 'dape-configs
    `(java-debug
    modes (java-mode java-ts-mode)
    fn (lambda (config)
        (with-current-buffer
            (find-file-noselect (expand-file-name (plist-get config :program)
                                                  (project-root (project-current))))
            (thread-first
              config
              (plist-put 'hostname "localhost")
              (plist-put 'port (eglot-execute-command (eglot-current-server)
                                                      "vscode.java.startDebugSession" nil))
              (plist-put :projectName (project-name (project-current))))))
    :program dape-buffer-default
    :request "attach"
    :hostname "localhost"
    :port 63343)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions