java.rmi.NotBoundException Java Examples

The following examples show how to use java.rmi.NotBoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: spring-analysis-note   Author: Vip-Augus   File: RmiServiceExporter.java    License: MIT License 6 votes vote down vote up
/**
 * Unbind the RMI service from the registry on bean factory shutdown.
 */
@Override
public void destroy() throws RemoteException {
	if (logger.isDebugEnabled()) {
		logger.debug("Unbinding RMI service '" + this.serviceName +
				"' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
	}
	try {
		this.registry.unbind(this.serviceName);
	}
	catch (NotBoundException ex) {
		if (logger.isInfoEnabled()) {
			logger.info("RMI service '" + this.serviceName + "' is not bound to registry" +
					(this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
		}
	}
	finally {
		unexportObjectSilently();
	}
}
 
Example #2
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: InheritedChannelNotServerSocket.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #3
Source Project: openAGV   Author: tcrct   File: StandardRemoteRouterService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }

  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(RegistrationName.REMOTE_ROUTER_SERVICE);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }

  initialized = false;
}
 
Example #4
Source Project: openAGV   Author: tcrct   File: StandardRemoteSchedulerService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }

  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(RegistrationName.REMOTE_SCHEDULER_SERVICE);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }

  initialized = false;
}
 
Example #5
Source Project: openAGV   Author: tcrct   File: StandardRemoteVehicleService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }

  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(RegistrationName.REMOTE_VEHICLE_SERVICE);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }

  initialized = false;
}
 
Example #6
Source Project: openAGV   Author: tcrct   File: StandardRemoteKernel.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }
  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(org.opentcs.access.rmi.RemoteKernel.REGISTRATION_NAME);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }
  userManager.terminate();
  registryProvider.terminate();
  enabled = false;
}
 
Example #7
Source Project: openAGV   Author: tcrct   File: StandardRemoteKernelClientPortal.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }

  for (KernelRemoteService remoteService : remoteServices) {
    remoteService.terminate();
  }

  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(RegistrationName.REMOTE_KERNEL_CLIENT_PORTAL);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }

  userManager.terminate();
  registryProvider.terminate();
  initialized = false;
}
 
Example #8
Source Project: openAGV   Author: tcrct   File: StandardRemoteTransportOrderService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }

  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(RegistrationName.REMOTE_TRANSPORT_ORDER_SERVICE);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }

  initialized = false;
}
 
Example #9
Source Project: openAGV   Author: tcrct   File: StandardRemoteNotificationService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void terminate() {
  if (!isInitialized()) {
    return;
  }

  try {
    LOG.debug("Unbinding from RMI registry...");
    rmiRegistry.unbind(RegistrationName.REMOTE_NOTIFICATION_SERVICE);
    LOG.debug("Unexporting RMI interface...");
    UnicastRemoteObject.unexportObject(this, true);
  }
  catch (RemoteException | NotBoundException exc) {
    LOG.warn("Exception shutting down RMI interface", exc);
  }

  initialized = false;
}
 
Example #10
Source Project: dragonwell8_jdk   Author: alibaba   File: InheritedChannelNotServerSocket.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #11
Source Project: TencentKona-8   Author: Tencent   File: InheritedChannelNotServerSocket.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #12
Source Project: java-technology-stack   Author: codeEngraver   File: RmiServiceExporter.java    License: MIT License 6 votes vote down vote up
/**
 * Unbind the RMI service from the registry on bean factory shutdown.
 */
@Override
public void destroy() throws RemoteException {
	if (logger.isDebugEnabled()) {
		logger.debug("Unbinding RMI service '" + this.serviceName +
				"' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
	}
	try {
		this.registry.unbind(this.serviceName);
	}
	catch (NotBoundException ex) {
		if (logger.isInfoEnabled()) {
			logger.info("RMI service '" + this.serviceName + "' is not bound to registry" +
					(this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
		}
	}
	finally {
		unexportObjectSilently();
	}
}
 
Example #13
Source Project: jdk8u60   Author: chenghanpeng   File: InheritedChannelNotServerSocket.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #14
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: InheritedChannelNotServerSocket.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #15
Source Project: mts   Author: ericsson-mts   File: SlaveReference.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected SlaveReference(String url) throws RemoteException, NotBoundException {
    int port = 2099;
    String host;
    if (url.contains(":")) {
        host = url.split(":")[0];
        port = Integer.parseInt(url.split(":")[1]);
    }
    else {
        host = url;
    }

    // get the slave interface
    _slaveIntf = (SlaveIntf) LocateRegistry.getRegistry(host, port).lookup("mts/slave");

    // try to initialize it
    _fsInterfaceImpl = new FSInterfaceImpl();
    _heartbeatCheckerImpl = new HeartbeatCheckerImpl();
    _multiplexedNotificationsReceiverImpl = new MultiplexedNotificationsReceiverImpl(_slaveIntf);
    _slaveIntf.connect(_fsInterfaceImpl, _heartbeatCheckerImpl, _multiplexedNotificationsReceiverImpl);
}
 
Example #16
Source Project: lams   Author: lamsfoundation   File: RmiServiceExporter.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Unbind the RMI service from the registry on bean factory shutdown.
 */
@Override
public void destroy() throws RemoteException {
	if (logger.isInfoEnabled()) {
		logger.info("Unbinding RMI service '" + this.serviceName +
				"' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
	}
	try {
		this.registry.unbind(this.serviceName);
	}
	catch (NotBoundException ex) {
		if (logger.isWarnEnabled()) {
			logger.warn("RMI service '" + this.serviceName + "' is not bound to registry"
					+ (this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
		}
	}
	finally {
		unexportObjectSilently();
	}
}
 
Example #17
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: InheritedChannelNotServerSocket.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            int registryPort = Integer.getInteger(
                    "test.java.rmi.rmidViaInheritedChannel.registry.port", 0);
            Registry registry = LocateRegistry.getRegistry(registryPort);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #18
Source Project: openAGV   Author: tcrct   File: RemoteKernelServicePortalProxy.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void login(@Nonnull String hostName, int port)
    throws CredentialsException, ServiceUnavailableException {
  requireNonNull(hostName, "hostName");

  if (isLoggedIn()) {
    LOG.warn("Already logged in, doing nothing.");
    return;
  }

  try {
    // Look up the remote portal with the RMI registry.
    Registry registry = LocateRegistry.getRegistry(hostName,
                                                   port,
                                                   socketFactoryProvider.getClientSocketFactory());

    setRemoteService((RemoteKernelServicePortal) registry.lookup(REMOTE_KERNEL_CLIENT_PORTAL));
    // Login and save the client ID.
    setClientId(getRemoteService().login(userName, password, eventFilter));
    // Get notified when a service call on us fails.
    setServiceListener(this);

    // Look up the remote services with the RMI registry and update the other service logins.
    updateServiceLogins(registry);
  }
  catch (RemoteException | NotBoundException exc) {
    resetServiceLogins();
    throw new ServiceUnavailableException("Exception logging in with remote kernel client portal",
                                          exc.getCause());
  }
}
 
Example #19
Source Project: openAGV   Author: tcrct   File: RemoteKernelServicePortalProxy.java    License: Apache License 2.0 5 votes vote down vote up
private void updateServiceLogins(Registry registry)
    throws RemoteException, NotBoundException {
  plantModelService
      .setClientId(getClientId())
      .setRemoteService((RemotePlantModelService) registry.lookup(REMOTE_PLANT_MODEL_SERVICE))
      .setServiceListener(this);

  transportOrderService
      .setClientId(getClientId())
      .setRemoteService((RemoteTransportOrderService) registry.lookup(REMOTE_TRANSPORT_ORDER_SERVICE))
      .setServiceListener(this);

  vehicleService
      .setClientId(getClientId())
      .setRemoteService((RemoteVehicleService) registry.lookup(REMOTE_VEHICLE_SERVICE))
      .setServiceListener(this);

  notificationService
      .setClientId(getClientId())
      .setRemoteService((RemoteNotificationService) registry.lookup(REMOTE_NOTIFICATION_SERVICE))
      .setServiceListener(this);

  dispatcherService
      .setClientId(getClientId())
      .setRemoteService((RemoteDispatcherService) registry.lookup(REMOTE_DISPATCHER_SERVICE))
      .setServiceListener(this);

  routerService
      .setClientId(getClientId())
      .setRemoteService((RemoteRouterService) registry.lookup(REMOTE_ROUTER_SERVICE))
      .setServiceListener(this);

  schedulerService
      .setClientId(getClientId())
      .setRemoteService((RemoteSchedulerService) registry.lookup(REMOTE_SCHEDULER_SERVICE))
      .setServiceListener(this);
}
 
Example #20
Source Project: openAGV   Author: tcrct   File: ProxyInvocationHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void login()
    throws CredentialsException {
  if (loggedIn()) {
    LOG.warn("Already logged in, doing nothing.");
    return;
  }
  try {
    // Look up the remote kernel with the RMI registry.
    Registry registry = LocateRegistry.getRegistry(hostName,
                                                   port,
                                                   socketFactoryProvider.getClientSocketFactory());
    RemoteKernel kernel = (RemoteKernel) registry.lookup(RemoteKernel.REGISTRATION_NAME);
    // Login, save the client ID and set the event filter.
    clientID = kernel.login(userName, password);
    kernel.setEventFilter(clientID, eventFilter);
    remoteKernel = kernel;
    // Start polling for events.
    eventPollerTask = new EventPollerTask(eventPollInterval, eventPollTimeout);
    Thread eventPollerThread = new Thread(eventPollerTask, "eventPoller");
    eventPollerThread.start();
  }
  catch (RemoteException | NotBoundException exc) {
    throw new KernelUnavailableException("Exception logging in with remote kernel", exc);
  }
  setConnectionState(State.LOGGED_IN);
}
 
Example #21
Source Project: dragonwell8_jdk   Author: alibaba   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the activation system stub if the specified name
 * matches the activation system's class name, otherwise
 * returns the result of invoking super.lookup with the specified
 * name.
 */
public Remote lookup(String name)
    throws RemoteException, NotBoundException
{
    if (name.equals(NAME)) {
        return systemStub;
    } else {
        return super.lookup(name);
    }
}
 
Example #22
Source Project: dragonwell8_jdk   Author: alibaba   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #23
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: RegistryFilterTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void simpleRejectableClass() throws RemoteException, AlreadyBoundException, NotBoundException {
    RejectableClass r1 = null;
    try {
        String name = "reject1";
        r1 = new RejectableClass();
        registry.bind(name, r1);
        registry.unbind(name);
        Assert.assertNull(registryFilter, "Registry filter should not have rejected");
    } catch (Exception rex) {
        Assert.assertNotNull(registryFilter, "Registry filter should have rejected");
    }
}
 
Example #24
Source Project: dragonwell8_jdk   Author: alibaba   File: RmidViaInheritedChannel.java    License: GNU General Public License v2.0 5 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("RmidSelectorProvider.inheritedChannel");
    if (channel == null) {
        /*
         * Create server socket channel and bind server socket.
         */
        channel = ServerSocketChannel.open();
        ServerSocket serverSocket = channel.socket();
        serverSocket.bind(
             new InetSocketAddress(InetAddress.getLocalHost(),
             TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
        System.err.println("serverSocket = " + serverSocket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example #25
Source Project: dragonwell8_jdk   Author: alibaba   File: RegistryFilterTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider="bindData")
public void simpleBind(String name, Remote obj, boolean blacklisted) throws RemoteException, AlreadyBoundException, NotBoundException {
    try {
        registry.bind(name, obj);
        Assert.assertFalse(blacklisted, "Registry filter did not reject (but should have) ");
        registry.unbind(name);
    } catch (Exception rex) {
        Assert.assertTrue(blacklisted, "Registry filter should not have rejected");
    }
}
 
Example #26
Source Project: dragonwell8_jdk   Author: alibaba   File: RegistryFilterTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void simpleRejectableClass() throws RemoteException, AlreadyBoundException, NotBoundException {
    RejectableClass r1 = null;
    try {
        String name = "reject1";
        r1 = new RejectableClass();
        registry.bind(name, r1);
        registry.unbind(name);
        Assert.assertNull(registryFilter, "Registry filter should have rejected");
    } catch (Exception rex) {
        Assert.assertNotNull(registryFilter, "Registry filter should not have rejected");
    }
}
 
Example #27
Source Project: dragonwell8_jdk   Author: alibaba   File: RegistryFilterTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void simpleDepthBuiltinNonRejectable() throws RemoteException, AlreadyBoundException, NotBoundException {
    int depthOverride = Integer.getInteger("test.maxdepth", REGISTRY_MAX_DEPTH);
    depthOverride = Math.min(depthOverride, REGISTRY_MAX_DEPTH);
    System.out.printf("overrideDepth: %d, filter: %s%n", depthOverride, registryFilter);
    try {
        String name = "reject2";
        DepthRejectableClass r1 = DepthRejectableClass.create(depthOverride);
        registry.bind(name, r1);
        registry.unbind(name);
    } catch (Exception rex) {
        Assert.fail("Registry filter should not have rejected depth: "
                        + depthOverride);
    }
}
 
Example #28
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: RegistryFilterTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void simpleDepthRejectable() throws RemoteException, AlreadyBoundException, NotBoundException {
    int depthOverride = Integer.getInteger("test.maxdepth", REGISTRY_MAX_DEPTH);
    depthOverride = Math.min(depthOverride, REGISTRY_MAX_DEPTH);
    System.out.printf("overrideDepth: %d, filter: %s%n", depthOverride, registryFilter);
    try {
        String name = "reject3";
        DepthRejectableClass r1 = DepthRejectableClass.create(depthOverride + 1);
        registry.bind(name, r1);
        Assert.fail("Registry filter should have rejected depth: " + depthOverride + 1);
    } catch (Exception rex) {
        // Rejection expected
    }
}
 
Example #29
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        super.unbind(name);
    }
}
 
Example #30
Source Project: TencentKona-8   Author: Tencent   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}