You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by joe <fi...@yahoo.de> on 2011/02/21 17:55:23 UTC
testing for running OpenEJB server
Hi,
What's the easiest way to test whether the container is running/stopped?
Currently i use netstat looking whether the concerning ports are in
state LISTENING, but doing this OS (language) independent
is a little unhandy.
Re: testing for running OpenEJB server
Posted by David Blevins <da...@gmail.com>.
On Feb 24, 2011, at 7:38 AM, joe wrote:
>> ********************************************************************************
>> 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 + "]");
>> }
>> }
>
> interesting, output here is:
>
> Program [5540] <--- OpenEJB
> [3056]
> [4240]
> App [4220]
> NetworkServerControl [2720]
>
> currently i stay with my java socket approach, but this is something good to know, thx
The command line tools use the EJB port as well. I've noticed when adding our JMX support that JConsole has some magical way of knowing the running java process on the local machine and can connect to them. Whatever it is I would really love to know how it works cause that could really improve our tools!
Side note, any ease of management stuff you come up with, I think would be great additions. The more users that are contributors and committers, the better! One of the advantages of open source should be that you don't have to build infrastructure *around* something, but you can actually build it *into* directly.
-David
Re: testing for running OpenEJB server
Posted by joe <fi...@yahoo.de>.
> ********************************************************************************
> 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 + "]");
> }
> }
interesting, output here is:
Program [5540] <--- OpenEJB
[3056]
[4240]
App [4220]
NetworkServerControl [2720]
currently i stay with my java socket approach, but this is something
good to know, thx
Re: testing for running OpenEJB server
Posted by Thiago Veronezi <th...@veronezi.org>.
ps.: from http://jroller.com/ethdsy/entry/list_the_running_vms
On Tue, Feb 22, 2011 at 12:31 PM, Thiago Veronezi <th...@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 <fi...@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?
>>
>>
>
Re: testing for running OpenEJB server
Posted by Thiago Veronezi <th...@veronezi.org>.
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 <fi...@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?
>
>
Re: testing for running OpenEJB server
Posted by joe <fi...@yahoo.de>.
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?
Re: testing for running OpenEJB server
Posted by Thiago Veronezi <th...@veronezi.org>.
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
<http://stackoverflow.com/questions/2735926/how-to-capture-pid-of-a-linux-daemon-run-from-init-d>
[]s,
Thiago.
On Mon, Feb 21, 2011 at 11:55 AM, joe <fi...@yahoo.de> wrote:
>
> Hi,
>
> What's the easiest way to test whether the container is running/stopped?
>
> Currently i use netstat looking whether the concerning ports are in state
> LISTENING, but doing this OS (language) independent
> is a little unhandy.
>