Buy anything from HongKong - Dealextreme

You can buy any kind of electronic gadgets from DealExtreme with free shipping option.
Please visit DealExtreme for very low prices.
Here is the link to the site : www.dealextreme.com

10 June 2008

Registering MBean to Weblogic Server

You can register your mbean to the weblogic mbean server during application initialization.
For this purpose you should extend weblogic.application.ApplicationLifecycleListener class.
Then you should override "public void postStart(ApplicationLifecycleEvent ev)" method to register your mbean:
ObjectName managerName = new ObjectName("Erhan:Name=MyApplication,Type=MyMBean");
InitialContext ctx = new InitialContext();
MBeanServer server = (MBeanServer) ctx.lookup("java:comp/jmx/runtime");
server.registerMBean(new MyMBean(), managerName);

By overriding the "public void preStop(ApplicationLifecycleEvent arg0)" method you can unregister your mbean. If you are looking up for the mbean server within the web application (J2EE module) (servlet, ejb etc) you should use
MBeanServer server = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");