如何在Linux中使用IntelliJ社区(免费)版本在本地调试Tomcat 7.x / 8.x webapp? [英] How to debug a Tomcat 7.x/8.x webapp locally with IntelliJ Community (free) version in Linux?

查看:108
本文介绍了如何在Linux中使用IntelliJ社区(免费)版本在本地调试Tomcat 7.x / 8.x webapp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可以与Ultimate Edition一起使用,但有没有办法在Community Edition中本地调试这些应用程序?

解决方案

历史记录



如果您使用过IntelliJ Ultimate版本,您已经看到可以添加Tomcat配置,您可以在其中调试或运行IntelliJ中的Tomcat容器。您可以通过一些额外的设置让您的IntelliJ社区版本为您做同样的事情。



相关概念



Tomcat JMX



这是Tomcat的远程监控和管理工具。启用调试不需要JMX相关设置。虽然它可以通过JConsole用于监控目的((对于Window onl非常有用) y))

  • IntelliJ和Tomcat .. Howto ..?(误导为旧)

  • IntelliJ终极版和社区版本设置(有帮助,但过于复杂)

  • IntelliJ IDEA 14.0.0 Web帮助/运行/调试配置:Tomcat (有点用)

  • 使用Tomcat和Intellij社区版进行调试(旧的和不完整的)


  • I understand that this is possible to do with the Ultimate Edition, but is there a way to debug these applications locally in the Community Edition?

    解决方案

    History

    If you have worked with IntelliJ Ultimate edition you have seen that it is possible to add a Tomcat configuration where you can both debug or run your Tomcat container from within IntelliJ. It is possible to get your IntelliJ Community version to do the same thing for you with a little bit of extra settings.

    Relevant concepts

    Tomcat JMX

    This is a remote monitoring and management tool for Tomcat. JMX related settings is not needed to enable your debugging. Although it can be useful for monitoring purposes through JConsole (read more).

    Different ports

    You instance of Tomcat must be already up and running for the Community version to be able to attach itself to the Tomcat process. While your tomcat will be running on a port (Tomcat default is 8080), you also need to setup another port for the debugger to attach itself to your running version of Tomcat (9999 in our example).

    Settings

    Settings include changes you need to make to your Tomcat and configurations you need to do on your IntelliJ community edition.

    Please follow the order in changes.

    Tomcat side related changes

    1. Stop your Tomcat if it is running in your Tomcat bin folder through: ./shutdown or ./catalina stop

    2. Add the following line to your catalina.sh file under the commented JAVA_OPTS set statement:

      JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999"

    HINT: I have used JAVA_OPTS not CATALINA_OPTS as the comments in catalina.sh suggests it is preferred to use JAVA_OPTS. However, it is possible to use CATALINA_OPTS in a similar manner to enable the debugging.

    1. Start Tomcat:

    ./catalina.sh start

    IntelliJ related changes

    Result

    After click on debug button in your IntelliJ Community edition your debug section should open with the following line in its Console area:

    Connected to the target VM, address: 'localhost:9999', transport: 'socket'

    Relevant posts and links

    1. Remote debugging with Tomcat (7) and Intellij (Very useful for Window only though)
    2. IntelliJ and Tomcat.. Howto..? (Misleading as it's old)
    3. IntelliJ ultimate and community version setups (Helpful but over complicated)
    4. IntelliJ IDEA 14.0.0 Web Help/Run/Debug Configuration: Tomcat (Somewhat useful)
    5. Debugging with Tomcat and Intellij Community Edition (Old and incomplete)

    这篇关于如何在Linux中使用IntelliJ社区(免费)版本在本地调试Tomcat 7.x / 8.x webapp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆