private void initialize(MBeanInstantiator instantiator, MetaData meta, String domain) { this.instantiator = instantiator; if (instantiator == null) throw new IllegalArgumentException("instantiator must not be null."); this.meta = (meta == null ? new MetaDataImpl(instantiator) : meta); this.secureClr = new SecureClassLoaderRepository(instantiator.getClassLoaderRepository()); if (domain != null) { interceptor = new DefaultMBeanInterceptor(this, domain); } else { interceptor = new DefaultMBeanInterceptor(this); } // Create the MBeanServer identification MBean try { MBeanServerDelegateObject = new MBeanServerDelegateImpl(new MBeanServerDelegate()); MBeanServerDelegateObjectName = new ObjectName(ServiceName.DELEGATE); interceptor.registerMBean(MBeanServerDelegateObject, MBeanServerDelegateObjectName); } catch (JMException e) { // This should never happen! final RuntimeException r = new RuntimeException("Unexpected JMException: " + e); Utils.initCause(r, e); throw r; } ClassLoader myLoader = this.getClass().getClassLoader(); final ModifiableClassLoaderRepository loaders = instantiator.getClassLoaderRepository(); if (loaders != null && myLoader != null) { loaders.addClassLoader(myLoader); } }