【问题标题】:Debug Helidon MP Application调试 Helidon MP 应用程序
【发布时间】:2020-11-19 20:36:02
【问题描述】:

我是 Helidon MP 的新手,我正在尝试实现我的第一个微服务。 我无法找到如何调试我的应用程序,有人可以指出一个好的示例或文档吗?有没有办法以调试模式或类似的方式启动运行时?

提前致谢

【问题讨论】:

    标签: helidon


    【解决方案1】:

    Helidon MP 在作为应用服务器的意义上并不是真正的运行时。它主要是您添加到项目中的库的集合。因此,您可以像调试任何其他 Java 应用程序一样调试使用 Helidon 的程序,即将 Java 调试开关添加到命令行。

    这是来自java -agentlib:jdwp=help 的输出,它应该可以帮助您开始基本的 Java 调试:

    $ $(/usr/libexec/java_home -v11)/bin/java -agentlib:jdwp=help
                   Java Debugger JDWP Agent Library
                   --------------------------------
    
      (see http://java.sun.com/products/jpda for more information)
    
    jdwp usage: java -agentlib:jdwp=[help]|[<option>=<value>, ...]
    
    Option Name and Value            Description                       Default
    ---------------------            -----------                       -------
    suspend=y|n                      wait on startup?                  y
    transport=<name>                 transport spec                    none
    address=<listen/attach address>  transport spec                    ""
    server=y|n                       listen for debugger?              n
    launch=<command line>            run debugger on event             none
    onthrow=<exception name>         debug on throw                    none
    onuncaught=y|n                   debug on any uncaught?            n
    timeout=<timeout value>          for listen/attach in milliseconds n
    mutf8=y|n                        output modified utf-8             n
    quiet=y|n                        control over terminal messages    n
    
    Obsolete Options
    ----------------
    strict=y|n
    stdalloc=y|n
    
    Examples
    --------
      - Using sockets connect to a debugger at a specific address:
        java -agentlib:jdwp=transport=dt_socket,address=localhost:8000 ...
      - Using sockets listen for a debugger to attach:
        java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y ...
    
    Notes
    -----
      - A timeout value of 0 (the default) is no timeout.
    
    Warnings
    --------
      - The older -Xrunjdwp interface can still be used, but will be removed in
        a future release, for example:
            java -Xdebug -Xrunjdwp:[help]|[<option>=<value>, ...]
    
    

    【讨论】:

    • (值得注意的是,“更多信息”工具输出的URL已经死了十多年了,新的“更多信息”URL应该是docs.oracle.com/en/java/javase/11/docs/specs/jpda/…)跨度>
    • 谢谢,我也是这么过来的。我现在可以在我的 IDE 中进行调试,但我认为将它集成到 helidon-cli 工具中或拥有一个 maven 插件会很棒。
    • 它确实支持它,使用helidon dev --app-debug 在调试模式下启动开发循环。一旦应用程序启动,它将打印调试端口。请参阅helidon help dev 了解更多信息。
    猜你喜欢
    • 2021-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多