How to start debug mode from command prompt for apache tomcat server?

前端 未结 9 1811
情深已故
情深已故 2020-12-02 05:11

I want to start debug mode for my application. But I need to start the debug mode from command prompt. Is it possible ? And will the procedure vary between tomcat 5.5 to tom

相关标签:
9条回答
  • 2020-12-02 05:18

    If you're wanting to do this via powershell on windows this worked for me

    $env:JPDA_SUSPEND="y"

    $env:JPDA_TRANSPORT="dt_socket"

    /path/to/tomcat/bin/catalina.bat jpda start

    0 讨论(0)
  • 2020-12-02 05:20

    For windows first set variables:

    set JPDA_ADDRESS=8000
    set JPDA_TRANSPORT=dt_socket
    

    to start server in debug mode:

    %TOMCAT_HOME%/bin/catalina.bat jpda start
    

    For unix first export variables:

    export JPDA_ADDRESS=8000
    export JPDA_TRANSPORT=dt_socket
    

    and to start server in debug mode:

    %TOMCAT_HOME%/bin/catalina.sh jpda start
    
    0 讨论(0)
  • 2020-12-02 05:24

    These instructions worked for me on apache-tomcat-8.5.20 on mac os 10.13.3 using jdk1.8.0_152:

    $ cd /path/to/apache-tomcat-8.5.20/bin
    $ export JPDA_ADDRESS="localhost:12321"
    $ ./catalina.sh jpda run
    

    Now connect to port 12321 from IntelliJ/Eclipse and enjoy remote debugging.

    0 讨论(0)
  • 2020-12-02 05:29

    First, Navigate to the TOMCAT-HOME/bin directory.

    Then, Execute the following in the command-line:

    catalina.bat jpda start
    

    If the Tomcat server is running under Linux, just invoke the catalina.sh program

    catalina.sh jpda start
    

    It's the same for Tomcat 5.5 and Tomcat 6

    0 讨论(0)
  • 2020-12-02 05:31

    A short answer is to add the following options when the JVM is started.

    JAVA_OPTS=" $JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8080"
    
    0 讨论(0)
  • 2020-12-02 05:34
    1. From your IDE, create a remote debug configuration, configure it for the default JPDA Tomcat port which is port 8000.

    2. From the command line:

      Linux:

      cd apache-tomcat/bin
      export JPDA_SUSPEND=y
      ./catalina.sh jpda run
      

      Windows:

      cd apache-tomcat\bin
      set JPDA_SUSPEND=y
      catalina.bat jpda run
      
    3. Execute the remote debug configuration from your IDE, and Tomcat will start running and you are now able to set breakpoints in the IDE.

    Note:

    The JPDA_SUSPEND=y line is optional, it is useful if you want that Apache Tomcat doesn't start its execution until step 3 is completed, useful if you want to troubleshoot application initialization issues.

    0 讨论(0)
提交回复
热议问题