A simple JMX application- Help !!!
Plz help me out.
I need to run a simple JMX application in JBoss. I would also be using JManage. Kindly can anyone help me out to run an agent for it. All the examples that I have got from the internet is using HTMLAdaptorServer. But I m using open source tools so I cannt download the stuff from sun.
I have a HelloWorld bean and HelloWorldMBean which is supposed write "Hello". Kindly help me to write the HelloAgent usning JManage.
Your help will be greatly apperciated!
You can test your application with JConsole. It's shiped with java 5. To write agent for that you should use RMI connector as follows :-
MBeanServer beanServer =MBeanServerFactory.createMBeanServer("MasterAgent");
try
{
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:port"/server");
JMXConnectorServer server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, beanServer);
server.start();
}catch(Exception e)
{
e.printStackTrace();
}
once you start above agent.. go to command prompt & start jconsole. It will ask you to which agent you want to connect. Select the advance tab & use above URL in "JMX URL" field. and say ok. It will so your managed resource & operation in the console..
Hope this makes sense...
cheers..