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");