如何在IntelliJ中调试Web服务? [英] how to debug a web service in IntelliJ?

查看:202
本文介绍了如何在IntelliJ中调试Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我做错了什么,请纠正我:

Please correct me if I did anything wrong:

  1. 我用Java创建了一个Web服务(WSDL),它具有方法TestCall().
  2. 我还创建了一个网站 http://testwebsite:8000/abc/index.html ,并且该网站正在步骤1中调用Web服务.
  3. 我在IntelliJ中为其创建了远程调试.我将testwebsite作为主机,将8000作为端口号.
  4. 一旦我访问 http://testwebsite:8000/abc/index.html 并单击TestCall(),它没有转到IntelliJ中的断点.当我尝试远程调试Web服务时,出现错误:
  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:

无法打开调试器端口(testwesite:8000),握手失败,连接永久关闭.

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

有人可以告诉我我错过了哪些步骤吗?谢谢

Can someone tell me what steps I missed? thanks

推荐答案

当您需要远程调试应用程序时,请转到IntelliJ中的设置(Run->Edit configurations).

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

现在单击+符号并添加Remote配置.它告诉您要添加到在远程计算机上启动的JVM的启动的命令行.会是这样的:

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适用于jvm 5-8.

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

现在,您可以使用这些额外的命令行选项在服务器上启动远程Web服务.然后,您可以在IntelliJ中启动此配置.它会告诉您Connected to target VM, address: 'server name', transport: 'socket'.您可以像使用本地调试一样添加断点.

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.

如您所见:远程调试不使用Web端口,而是打开一个专门用于调试目的的不同端口.如果服务器和工作站之间存在防火墙,请选择一个打开的端口,或者打开防火墙端口(如果可能).

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).

这篇关于如何在IntelliJ中调试Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆