There are 1 code examples for javax.management.MalformedObjectNameException.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: codecover Package: org.codecover.eclipse.livenotification

Source Code: LiveNotificationClient.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Connects this {@link LiveNotificationClient} with the given server
 * through the given port
 * @param hostthe host to connect to
 * @param portthe port to be used
 * @throws LiveNotificationExceptionWraps an {@link IOException} occurred while communicating
 * with the server.
 */
public void connect(String host,int port) throws LiveNotificationException {
  try {
    Registry registry=LocateRegistry.getRegistry(host,port);
    RMIServer server=(RMIServer)registry.lookup(LOOKUP_JMXRMI);
    this.connector=new RMIConnector(server,null);
    this.connector.connect();
    this.serverConnection=this.connector.getMBeanServerConnection();
    Set<?> nameSet=this.serverConnection.queryNames(this.mbeanName,null);
    if (nameSet.isEmpty()) {
      this.clientState=ConnectionState.CONNECTED_NO_MBEAN;
    }
 else {
      this.clientState=ConnectionState.CONNECTED_WITH_MBEAN;
    }
    sendStateChangeEvent();
    Set<?> delegateSet=this.serverConnection.queryNames(new ObjectName(SERVER_DELEGATE_NAME),null);
    for (    Object serverDelegateName : delegateSet) {
      this.listener=new RegistrationListener();
      this.serverDelegateObjectName=(ObjectName)serverDelegateName;
      this.serverConnection.addNotificationListener(this.serverDelegateObjectName,this.listener,null,null);
    }
  }
 catch (  RemoteException e) {
    throw new LiveNotificationRemoteException(ERROR_ESTABLISHING_THE_CONNECTION,e);
  }
catch (  NotBoundException e) {
    throw new LiveNotificationNotBoundException(ERROR_LOOKUP_REGISTRY,e);
  }
catch (  IOException e) {
    disconnect();
    throw new LiveNotificationIOException(ERROR_WITH_THE_CONNECTION,e);
  }
catch (  MalformedObjectNameException e) {
    throw new Error(e);
  }
catch (  InstanceNotFoundException e) {
    throw new Error(e);
  }
}