arthas/tutorials/katacoda/command-vmtool-cn/vmtool-classloader.md
2021-05-14 01:00:50 +08:00

1.1 KiB

指定 classloader name

vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext{{execute T2}}

指定 classloader hash

可以通过sc命令查找到加载class的 classloader。

$ sc -d org.springframework.context.ApplicationContext
 class-info        org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext
 code-source       file:/private/tmp/demo-arthas-spring-boot.jar!/BOOT-INF/lib/spring-boot-1.5.13.RELEASE.jar!/
 name              org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext
...
 class-loader      +-org.springframework.boot.loader.LaunchedURLClassLoader@19469ea2
                     +-sun.misc.Launcher$AppClassLoader@75b84c92
                       +-sun.misc.Launcher$ExtClassLoader@4f023edb
 classLoaderHash   19469ea2

然后用-c/--classloader 参数指定:

vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext