JMX Remote and MBeans in separate Processes

Hi,

I found on Sun blogs - http://blogs.sun.com/jmxetc/entry/what_is_jmx

following:

"An EJB lives in an Application Server container. It usually implements business logic. An MBean lives in an MBeanServer, and usually implements management logic"

That means, when an MBeanServer is killed, an MBeans dont't run anymore?

I have several Java applications.

I want use the JMX to manage (remote) this applications (start, stop, status watch) I created one MBean for every application and registered them on an MBeanServer. I can now start, stop application and observe the status.

public interface AdapterMBean {

String getStatus();

void start();

void stop();

}

But when I kill the process of MBeanServer, my applications don't run anymore.

Method start() starts application in new Thread.

Can JMX fulfil this requirement, that an MBeanServer runs in its own process and MBeans run in separate processes (now on the same machine)?

If yes, what shoul I do?

thanx

Peter

[1080 byte] By [Peter212a] at [2007-11-26 18:16:13]
# 1

> Hi,

> I found on Sun blogs -

> http://blogs.sun.com/jmxetc/entry/what_is_jmx

> following:

> "An EJB lives in an Application Server container. It

> usually implements business logic. An MBean lives in

> an MBeanServer, and usually implements management

> logic"

>

> That means, when an MBeanServer is killed, an MBeans

> dont't run anymore?

You don't kill an MBeanServer. What do you mean by 'kill an MBeanServer'?

> I have several Java applications.

> I want use the JMX to manage (remote) this

> applications (start, stop, status watch) I created

> one MBean for every application and registered them

> on an MBeanServer. I can now start, stop application

> and observe the status.

>

> public interface AdapterMBean {

>String getStatus();

>void start();

>void stop();

>

>

> But when I kill the process of MBeanServer, my

> applications don't run anymore.

> Method start() starts application in new Thread.

> Can JMX fulfil this requirement, that an MBeanServer

> runs in its own process and MBeans run in separate

> processes (now on the same machine)?

> If yes, what shoul I do?

> thanx

> Peter

When you kill a process, you kill all its execution threads.

A thread is not a process. It runs within a process.

If you want your applications to remain alive when you kill

the process that started them you need to start them in a

new separate process. See System.exec().

The question is: why do you kill the process that runs all your

applications in the first place?

Are you sure you are doing what you want to do?

regards,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/roller/page/jmxetc

dfuchsa at 2007-7-9 5:49:47 > top of Java-index,Core,Monitoring & Management...
# 2

>You don't kill an MBeanServer. What do you mean by 'kill an MBeanServer'?

kill -9 $PID - Kill a process bound with MBeanServer. (Environment IBM AIX)

>The question is: why do you kill the process that runs all your

>applications in the first place?

>Are you sure you are doing what you want to do?

This process should'nt be killed usually, but if a process with MBeanServer doesn't run (from unknown reasons), applications (simple java appl.) managed by JMX should remain alive. This is my objective. And a question: how can I reach this?

regards,

Peter

Peter212a at 2007-7-9 5:49:47 > top of Java-index,Core,Monitoring & Management...
# 3

Hi,

The application and the MBeanServer usually live in the same process.

In the case where you want to manage several applications, running each

in its own process, from a single entry point, you would usually use

'cascading' or federation.

In each application process you would create one MBeanServer (or simply use

the platform MBeanServer) in which you would register the application MBeans.

You would also create a JMXConnectorServer (or use the default, if you choose

to use the platform MBeanServer) - in order to make these MBeans available

to remote application.

Then you would create another MBeanServer (possibly in a new process) in

which you would 'mount' the MBeans exposed by each application.

In this case 'mount' means that you would create a DynamicMBean proxy that

forwards everything to its proxied MBean through a JMXConnector connected

to the remote application.

The Java DMK from sun has a ready to use framework that will allow you to

put in place and experiment such a solution.

You will find some interesting pointers in my answer to this thread:

http://forum.java.sun.com/thread.jspa?threadID=5132919&messageID=9481332#9481332

Hope this helps,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/jmxetc

dfuchsa at 2007-7-9 5:49:47 > top of Java-index,Core,Monitoring & Management...
# 4
Thanks for help Daniel.best regardsPeter
Peter212a at 2007-7-9 5:49:47 > top of Java-index,Core,Monitoring & Management...