问题
Please correct me if I did anything wrong:
- I created a web service (WSDL) in Java and it has a method
TestCall()
. - I also created a website http://testwebsite:8000/abc/index.html, and this website is calling the web service in step 1.
- I created a remote debugging for it in IntelliJ. I put testwebsite as the host and 8000 as the port number.
- 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