java 无法在 IntelliJ 中调试网络服务代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12140428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Not able to debug webservice code in IntelliJ
提问by C4CodeE4Exe
I have a window service that I have installed.I have the source code of the application opened in Intelli J.
我已经安装了一个窗口服务。我在 Intelli J 中打开了应用程序的源代码。
I made configuration IntelliJ as following
我将 IntelliJ 配置如下
I checked the PID of the service and port it is using.
我检查了服务的 PID 和它使用的端口。
While running Remote config in Intelli J it is giving following error
在 Intelli J 中运行远程配置时出现以下错误
4:09:18 PM Error running Remote: Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
Can someone please shed some light on how to debug window service in IntelliJ. It is a job schedule application.
有人可以解释一下如何在 IntelliJ 中调试窗口服务。这是一个工作计划应用程序。
The installService.cmd is as follows
installService.cmd 如下
set HOME_DIR=%~dp0
set SERVICE="Service_Name"
SET JAVA_OPTIONS=-Xms256m -Xmx256m
@echo Service name is Service_Name
"pathname\Service_Name.exe" -install %SERVICE% %JVM% %JAVA_OPTIONS% -Djava.class.path="pathname\Service_Name.jar" -Dorg.quartz.properties="pathname/Service_NameScheduler.properties" -start com.org.st.Service_Name -stop com.org.st.Service_Name -out "D:/core_log\Service_Name_service_out.log" -err "D:/core_log\Service_Name_service_error.log" -current "pathname\apps"
set JVM="C:/Program Files/Java/jdk1.6.0_29/jre/bin/server/jvm.dll"
回答by Da_Vicki
Check the port number. It should be same as in JAVA_OPTIONS & Intellij Idea Debugger remote configuration under port no.
检查端口号。它应该与端口号下的 JAVA_OPTIONS 和 Intellij Idea Debugger 远程配置中的相同。
回答by Vic
Please append the command line arguments from the IntelliJ debug configuration to the SET JAVA_OPTIONS
line, it will be something like
请将 IntelliJ 调试配置中的命令行参数附加到该SET JAVA_OPTIONS
行中,它将类似于
SET JAVA_OPTIONS=-Xms256m -Xmx256m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=51211
And reinstall the service.
并重新安装服务。
回答by Matt Brock
Make sure whatever port you're listening on isn't blocked by a firewall.
确保您正在侦听的任何端口都没有被防火墙阻止。