我想将调试器附加到名为Mamute的github项目中。 run.sh连接应用程序。 cat run.sh读取:
#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" MAMUTE_DIR=$SCRIPT_DIR TIMESTAMP=BUILD_TIMESTAMP WEB_INF=${SCRIPT_DIR}/WEB-INF java -cp ${WEB_INF}/classes/:${WEB_INF}/lib/* \ -Ddeploy.timestamp=$TIMESTAMP \ -Dvraptor.webappdir=${MAMUTE_DIR} \ ${MAMUTE_OPTS} \ br.com.caelum.vraptor.server.Main \ not-grunt我不知道“java -cp XXX”是什么意思。 我知道这是一个网络应用程序,所以我试着像我在Windows中使用visual studio调试东西一样附加到PID。
在使用“gksu / usr / bin / netbeans”启动netbeans之后,我转到顶层菜单> Debugger> Attach Debugger>
Java调试器(JPDA) 流程附件(通过pid) 运输=本地 PID = XXXX(运行“lsof -i:8080”获得的XXXX)单击附加。 错误:
不是调试对象,也不是正在侦听要附加的调试器。
我正在运行Debian。
I want to attach a debugger to a github project called Mamute. run.sh wires up the application. cat run.shreads:
#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" MAMUTE_DIR=$SCRIPT_DIR TIMESTAMP=BUILD_TIMESTAMP WEB_INF=${SCRIPT_DIR}/WEB-INF java -cp ${WEB_INF}/classes/:${WEB_INF}/lib/* \ -Ddeploy.timestamp=$TIMESTAMP \ -Dvraptor.webappdir=${MAMUTE_DIR} \ ${MAMUTE_OPTS} \ br.com.caelum.vraptor.server.Main \ not-gruntI don't know what "java -cp XXX" means. I know this is a web app so I tried to attach to the PID just like I would if I were debugging something in windows using visual studio.
After launching netbeans with "gksu /usr/bin/netbeans", I go to top menu > Debugger > Attach Debugger >
Java Debugger (JPDA) Process Attach (by pid) Transport = local PID = XXXX (XXXX obtained by running "lsof -i :8080)Click Attach. Error:
Not a debuggee or not listening for a debugger to attach.
I'm running Debian.
最满意答案
在这里,您可以在调试模式下运行mamut,将以下选项添加到run.sh的java命令
-Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n然后,您必须在netbeans中选择dt_socket传输选项附加调试器。
请注意,如果suspend为'n',则应用程序将立即启动,不会等待调试器附加到它。 如果是'y',申请将被暂停,直到您附上申请。
Here you can run mamut in debug mode adding the following options to the java command in run.sh
-Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=nYou then have to attach the debugger in netbeans choosing the dt_socket transport option.
Note that, if suspend is 'n', the application will start immediately and will not wait for a debugger to attach to it. If 'y', the application will be suspended until you attach to it.
更多推荐
发布评论