how to debug a web service in IntelliJ?

流过昼夜 提交于 2019-12-25 03:17:17

问题


Please correct me if I did anything wrong:

  1. I created a web service (WSDL) in Java and it has a method TestCall().
  2. I also created a website http://testwebsite:8000/abc/index.html, and this website is calling the web service in step 1.
  3. I created a remote debugging for it in IntelliJ. I put testwebsite as the host and 8000 as the port number.
  4. Once I went to http://testwebsite:8000/abc/index.html and click on TestCall(), it didn't go to the breakpoint in IntelliJ. When I was trying to remote debug the web service, I got error:

    Unable to open debugger port (testwesite:8000), handshake failed, connection permanently closed.

Can someone tell me what steps I missed? thanks


回答1:


When you need to remotely debug an application, go to the settings (Run->Edit configurations) in IntelliJ.

Now click the + sign and add a Remote configuration. It tells you the command line to add to the startup of the JVM you start on the remote machine. It will be something like:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 for jvm 5-8.

Now you can start your remote web service on the server with these extra command line options. Then you start this configuration in IntelliJ. It will tell you Connected to target VM, address: 'server name', transport: 'socket'. You can add breakpoints as you are used to with local debugging.

As you see: the remote debugging does not use the web-port, but a different port that is opened especially for debugging purposes. If there are firewalls between the server and your workstation, please choose a port that is open, or have the firewall port opened (if possible).



来源:https://stackoverflow.com/questions/52799330/how-to-debug-a-web-service-in-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!