eclipse 远程调试 Jetty(无 mvn,无插件)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1088725/
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
Remote debug Jetty (no mvn, no plugins)
提问by rafa.ferreira
Past scenario
- Work with Tomcat and start in debug modeand Remote Debugwith Eclipse.
- Define a port and connect with eclipse in this debug/remote port.
- Use to debug servers in other hosts/servers
过去的场景
- 使用 Tomcat 并以调试模式启动,并使用 Eclipse 进行远程调试。
- 在这个调试/远程端口中定义一个端口并与eclipse连接。
- 用于调试其他主机/服务器中的服务器
Today scenario
Now, I'm using Jettyand I've try to do the same, but with no success, could anyone help-me with that?
I did not use Maven, and did not want to start Jetty inside from my Eclipse.
今天的场景
现在,我正在使用Jetty,我也尝试这样做,但没有成功,有人可以帮我吗?
我没有使用 Maven,也不想从我的 Eclipse 中启动 Jetty。
Environment:
Windows XP
Java V. 5
Jetty V. 6.1.15
环境:
Windows XP
Java
V.5 Jetty V.6.1.15
Links:
http:// docs.codehaus.org/display/JETTY/Debugging
This did not help me!
http:// docs.codehaus.org/display/JETTY/Debugging+Jetty+with+Eclipse
http:// neelzone.wordpress.com/2007/06/18/jetty-and-eclipse-integration
These are to start insideEclipse
链接:
http://docs.codehaus.org/display/JETTY/Debugging
这对我没有帮助!
http://docs.codehaus.org/display/JETTY/Debugging+Jetty+with+Eclipse
http://neelzone.wordpress.com/2007/06/18/jetty-and-eclipse-integration
这些是在Eclipse 中启动的
回答by David Rabinowitz
This is what we are adding to our JBoss command line while development:
这是我们在开发时添加到 JBoss 命令行的内容:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
Then we launch the eclipse remote debugging and connection to this port.
然后我们启动eclipse远程调试并连接到这个端口。
Update:
更新:
To run from jar (standalone) do the following
要从 jar(独立)运行,请执行以下操作
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8585,server=y,suspend=n -jar start.jar
回答by andri
For remote debugging you should use JPDA. There's a sort of tutorialish article about it available here.
对于远程调试,您应该使用JPDA。有一种关于它的可用tutorialish文章在这里。
In short, start your JVM with the argument:
简而言之,使用以下参数启动您的 JVM:
-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n
and you are able to connect to the underlying JVM listening on port 8000 via the standard Eclipse debugger.
并且您可以通过标准 Eclipse 调试器连接到侦听端口 8000 的底层 JVM。
回答by Maciek Kreft
If you will use mvn jetty:runone day, you have to
如果有一天你会使用mvn jetty:run,你必须
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"
appending -Xdebug ...
doesn't works
附加-Xdebug ...
不起作用
回答by Malcolm Boekhoff
Using the JVM "agentlib" command-line parameter before "start.jar" did not work for me, but this does:
在“start.jar”之前使用JVM“agentlib”命令行参数对我不起作用,但这样做:
How to allow Eclipse to remotely debug #Jetty (#JPDA #agentlib:jdwp) on port 8000
如何允许 Eclipse 在端口 8000 上远程调试 #Jetty (#JPDA #agentlib:jdwp)
You have to create a file, $JETTY_BASE/start.ini(do not change $JETTY_HOME/start.ini) and put the following two lines in it:
您必须创建一个文件$JETTY_BASE/start.ini(不要更改$JETTY_HOME/start.ini)并将以下两行放入其中:
- --exec
- -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n
- --exec
- - agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n