debugging java application deployed in tomcat

后端 未结 7 1545
刺人心
刺人心 2021-02-01 03:31

I have an application that I deployed in tomcat. Later I configured the code as a project in Eclipse. I want to connect to the tomcat via eclipse and debug the application. Tryi

相关标签:
7条回答
  • 2021-02-01 04:17

    Steps to setup the tomcat Debugger with eclipse

    Install the following things:

    java 1.8+

    eclipse EE version

    download tomcat 8+

    open eclipse and go to servers tab and add a new server(window-> show View-> Others -> Search Servers)

    Mark your project as Dynamic web Project(Rightclick on Project-> project facets -> select Dynamic web module)

    Export war (File-> Export-> search war -> select module and choose the path)

    Run as -> Run on Server

    Start the tomcat Server in Debug or Run Mode

    check on localhost:8080

    0 讨论(0)
  • 2021-02-01 04:19

    First, you need to run Tomcat in debugging mode. The easiest way to do that is to modify the startup file (.bat or .sh depending if you are Windows or not). Find the line near or at the end of the file that contains the start command, and change it to jpda start. This will cause Tomcat to start in debugging mode listening on port 8000.

    Next, to connect to this process via Eclipse, select the Run menu and choose Debug Configurations.... In the pane on the left, choose Remote Java Application and click the New launch configuration button above the list. The important settings to note are the Host and Port fields. The host value must match the hostname of the Tomcat process, and the port should be 8000. You also might need to add entries on the Source tab to ensure that all of the source code is available to step through.

    0 讨论(0)
  • 2021-02-01 04:23

    yes, you need to configure tomcat to accept remote debugging connections. There is a FAQ on how to do it with various IDEs.

    http://wiki.apache.org/tomcat/FAQ/Developing#Q2

    0 讨论(0)
  • 2021-02-01 04:24
    1. Create a new tomcat server

    1. Create a new dynamic web project

    Export war to tomcat server

    1. Tomcat debug configuration(important), first double click tomcat server, then select "Use Tomcat installation (takes control of Tomcat installation)"

    1. Add breakpoints

    1. Run tomcat in debug mode

    1. Test war in web browser

    1. Edit source path

    1. Debug source code in Tomcat

    The war file is available here.

    0 讨论(0)
  • 2021-02-01 04:28
    1. Right Click on the project you want to debug and go to Debug As Menu and in the list click on Debug Configurations.

    1. Then Double click on the Remote Java Application from left menu list. browse for the project u wanna add in then click apply.

      • Also change the listening port to 7999, then after you started the web app from your localhost click the debug button on the same window. Then any break point's will be hit after that.

    0 讨论(0)
  • 2021-02-01 04:32

    Simply change the line in startup.bat (if you are using Windows)

    from:

    call "%EXECUTABLE%" start %CMD_LINE_ARGS%
    

    to:

    call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
    
    0 讨论(0)
提交回复
热议问题