环境:
- 操作系统:Mac 10.13.6
- Java-8
- 雄猫 7
- Intellij 社区 2019.3
- 摇篮 5.2.1
命令行输出:
$ export GRADLE_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=address=5005"
$ ./gradlew myproj-web-java:tomcatRunWar
Listening for transport dt_socket at address: 5005
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
运行/调试配置:
Debugger Mode: Attach to remote JVM
Use module classpath: myproj-parent:myproj-web-java:main
开始调试,Intellij 输出:
Connected to the target VM, address: 'localhost:5005', transport: 'socket'
我在控制器中添加断点并通过浏览器访问页面。页面渲染正确,我可以看到控制台输出的日志,但是断点没有命中。
如果我在 Intellij 中暂停程序,我可以看到主线程的堆栈:
kevent0:-1, KQueueArrayWrapper (sun.nio.ch)
poll:198, KQueueArrayWrapper (sun.nio.ch)
doSelect:117, KQueueSelectorImpl (sun.nio.ch)
lockAndDoSelect:86, SelectorImpl (sun.nio.ch)
select:97, SelectorImpl (sun.nio.ch)
select:101, SelectorImpl (sun.nio.ch)
read:179, SocketConnection$SocketInputStream (org.gradle.internal.remote.internal.inet)
fill:139, Input (com.esotericsoftware.kryo.io)
require:159, Input (com.esotericsoftware.kryo.io)
readInt:308, Input (com.esotericsoftware.kryo.io)
readSmallInt:120, KryoBackedDecoder (org.gradle.internal.serialize.kryo)
read:139, DefaultSerializerRegistry$TaggedTypeSerializer (org.gradle.internal.serialize)
read:36, Serializers$StatefulSerializerAdapter$1 (org.gradle.internal.serialize)
receive:80, SocketConnection (org.gradle.internal.remote.internal.inet)
receive:75, DaemonClientConnection (org.gradle.launcher.daemon.client)
receive:35, DaemonClientConnection (org.gradle.launcher.daemon.client)
monitorBuild:211, DaemonClient (org.gradle.launcher.daemon.client)
executeBuild:179, DaemonClient (org.gradle.launcher.daemon.client)
execute:142, DaemonClient (org.gradle.launcher.daemon.client)
execute:93, DaemonClient (org.gradle.launcher.daemon.client)
run:52, RunBuildAction (org.gradle.launcher.cli)
execute:207, Actions$RunnableActionAdapter (org.gradle.internal)
execute:402, CommandLineActionFactory$ParseAndBuildAction (org.gradle.launcher.cli)
execute:375, CommandLineActionFactory$ParseAndBuildAction (org.gradle.launcher.cli)
execute:37, ExceptionReportingAction (org.gradle.launcher.cli)
execute:23, ExceptionReportingAction (org.gradle.launcher.cli)
execute:368, CommandLineActionFactory$WithLogging (org.gradle.launcher.cli)
execute:298, CommandLineActionFactory$WithLogging (org.gradle.launcher.cli)
doAction:36, Main (org.gradle.launcher)
run:45, EntryPoint (org.gradle.launcher.bootstrap)
invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
invoke:62, NativeMethodAccessorImpl (sun.reflect)
invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
invoke:498, Method (java.lang.reflect)
runNoExit:60, ProcessBootstrap (org.gradle.launcher.bootstrap)
run:37, ProcessBootstrap (org.gradle.launcher.bootstrap)
main:23, GradleMain (org.gradle.launcher)
主线程或其他线程中没有我的代码。但是,如果我检查进程列表,似乎没有用于 tomcat 的独立 jvm 进程。
当程序暂停时,我仍然可以在控制台输出暂停时访问该页面。