tomcat server instance debugging in the eclipse

2019-09-16 17:36发布

I have the following configuration in the eclipse

  1. Created a tomcat 7.0 server instance from the servers view.
  2. Created a sample web application and deployed in the server through maven-tomcat-plugin and tested it in the browser ( started the server by right clicking the server from the server view and selected start )
  3. Tried to configure the remote debugging settings in the created server instance using JPDA options,i added the env variables in the server setting.
  4. i could not connect the debugger to the server when i start the server from the eclipse as like previously.
  5. But it connected seamlessly when i start the directly from the installation directory using the command prompt as like

    catlina.bat jpda start

  6. After that i tried this I started the server instance by ( started the server by right clicking the server from the server view and selected DEBUG mode)
  7. I got the Break points in the code and even Hot Code replacement working!!!
Can anyone explain the following?

  1. What goes wrong when i tried jpda options for the remote debugging with the created server instance in the eclipse?
  2. How the debug option and Hot Code replacement works with the server instance?Is this remote debugging or something else?Can you explain on this one?

1条回答
仙女界的扛把子
2楼-- · 2019-09-16 17:51

the eclipse tomcat plugin spawns a separate JVM while running, you can confirm that in the windows task list, using ps in unix like systems or using visualVM.

That VM is launched in debug mode with the JPDA parameters set by the plugin itself, and that is how the debugging mechanism works, it's based on the JVM functionality. You can confirm which jpda parameters are used by using visual VM, that comes with the JDK.

I don't think you can override the JPDA parameters that the eclipse plugin setted for you, that's why in point 1) it did not work. For 2) it works via remote debugging made transparent by automatic setting the parameters and connecting the remote debugger once the server starts.

查看更多
登录 后发表回答