private MBeanContainer(String domain, int port) { _domain=domain;  List servers = MBeanServerFactory.findMBeanServer(null); if (servers!=null) { for (Iterator iter=servers.iterator();iter.hasNext();) { MBeanServer server = (MBeanServer)iter.next(); if (_server==null || server.getDefaultDomain()!=null && server.getDefaultDomain().equals(_domain)) _server=server; } } if (_server==null) _server=MBeanServerFactory.createMBeanServer(_domain);  if (port>0) { try { Log.warn("HttpAdaptor for mx4j is not secure"); ObjectName name = new ObjectName("mx4j:name=HttpAdaptor"); _server.createMBean("mx4j.tools.adaptor.http.HttpAdaptor", name, null); _server.setAttribute(name, new Attribute("Port", new Integer(port))); _server.setAttribute(name, new Attribute("Host", "localhost"));  ObjectName processorName = new ObjectName("mx4j:name=XSLTProcessor"); _server.createMBean("mx4j.tools.adaptor.http.XSLTProcessor", processorName, null); _server.setAttribute(name, new Attribute("ProcessorName", processorName));  _server.invoke(name, "start", null, null); } catch(Exception e) { Log.warn(e); } } }
public MBeanContainer(MBeanServer server) { this._server = server; Container.addEventListener(this); }
    private MBeanContainer(String domain, int port)    {        _domain=domain;                List servers = MBeanServerFactory.findMBeanServer(null);        if (servers!=null)        {            for (Iterator iter=servers.iterator();iter.hasNext();)               {                MBeanServer server = (MBeanServer)iter.next();                if (_server==null || server.getDefaultDomain()!=null && server.getDefaultDomain().equals(_domain))                    _server=server;            }        }        if (_server==null)            _server=MBeanServerFactory.createMBeanServer(_domain);                if (port>0)        {            try            {                Log.warn("HttpAdaptor for mx4j is not secure");                ObjectName name = new ObjectName("mx4j:name=HttpAdaptor");                _server.createMBean("mx4j.tools.adaptor.http.HttpAdaptor", name, null);                _server.setAttribute(name, new Attribute("Port", new Integer(port)));                _server.setAttribute(name, new Attribute("Host", "localhost"));                                ObjectName processorName = new ObjectName("mx4j:name=XSLTProcessor");                _server.createMBean("mx4j.tools.adaptor.http.XSLTProcessor", processorName, null);                _server.setAttribute(name, new Attribute("ProcessorName", processorName));                                _server.invoke(name, "start", null, null);            }            catch(Exception e)            {                Log.warn(e);            }        }    }