/**
  * Connects to the remote <code>MBeanServer</code> using the configured <code>JMXServiceURL</code>
  * .
  *
  * @see #setServiceUrl(String)
  * @see #setConnectOnStartup(boolean)
  */
 private void connect() throws MBeanServerNotFoundException {
   if (this.serviceUrl != null) {
     if (logger.isDebugEnabled()) {
       logger.debug("Connecting to remote MBeanServer at URL [" + this.serviceUrl + "]");
     }
     try {
       this.connector = JMXConnectorFactory.connect(this.serviceUrl);
       this.server = this.connector.getMBeanServerConnection();
     } catch (IOException ex) {
       throw new MBeanServerNotFoundException(
           "Could not connect to remote MBeanServer at URL [" + this.serviceUrl + "]", ex);
     }
   } else {
     logger.debug("Attempting to locate local MBeanServer");
     this.server = JmxUtils.locateMBeanServer();
   }
 }