ps.: from http://jroller.com/ethdsy/entry/list_the_running_vms
On Tue, Feb 22, 2011 at 12:31 PM, Thiago Veronezi <thi...@veronezi.org>wrote: > Hmmm... this way you could get bad results if your server is running on > another port. > I've found another way to check of running VMs... It can help you to find > what you want... > > > ******************************************************************************** > public void runningVMs() throws MonitorException, URISyntaxException { > MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost("localhost"); > Set<Integer> activeVms = monitoredHost.activeVms(); > for (int psId : activeVms) > { > MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(new > VmIdentifier(String.valueOf(psId))); > String mainClass = MonitoredVmUtil.mainClass(monitoredVm, false); > System.out.println(mainClass + " [" + psId + "]"); > } > } > *********************************************************** > > <dependency> > <groupId>com.sun</groupId> > <artifactId>tools</artifactId> > <version>1.4.2</version> > <scope>system</scope> > <systemPath>c:/dev/jdk1.6.0_24/lib/tools.jar</systemPath> > </dependency> > > > > []s, > Thiago > > > On Tue, Feb 22, 2011 at 3:25 AM, joe <fischauto...@yahoo.de> wrote: > >> Hi, >> >> >> If you are running it on a linux box, check this link. >>> >>> >>> http://stackoverflow.com/questions/2735926/how-to-capture-pid-of-a-linux-daemon-run-from-init-d >>> >> >> Hm i am looking for ease of use and in a more platform independet way. >> I hoped for a feature directly supported by the container. >> >> Currently i am thinking of writing two Java methods: >> >> boolean isContainerRunning() >> >> 1. connect to ejbd port >> 2. if succesful: return true, otherwise false >> >> boolean areEJBsInvocable() >> >> 1. invoke EJB method >> 2. if result is as expected return true, otherwise false >> >> >> Would this be a reasonable approach? >> >> >