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 File: StandardRemoteNotificationService.java    From openAGV with 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 #2
Source File: InheritedChannelNotServerSocket.java    From dragonwell8_jdk with 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 File: InheritedChannelNotServerSocket.java    From jdk8u60 with 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 #4
Source File: RmiServiceExporter.java    From lams with 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 #5
Source File: SlaveReference.java    From mts with 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 #6
Source File: RmiServiceExporter.java    From java-technology-stack with 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 #7
Source File: InheritedChannelNotServerSocket.java    From openjdk-jdk8u with 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 #8
Source File: InheritedChannelNotServerSocket.java    From TencentKona-8 with 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 #9
Source File: StandardRemoteTransportOrderService.java    From openAGV with 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 #10
Source File: StandardRemoteKernelClientPortal.java    From openAGV with 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 #11
Source File: StandardRemoteKernel.java    From openAGV with 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 #12
Source File: StandardRemoteVehicleService.java    From openAGV with 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 #13
Source File: StandardRemoteSchedulerService.java    From openAGV with 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 #14
Source File: InheritedChannelNotServerSocket.java    From openjdk-jdk9 with 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 #15
Source File: StandardRemoteRouterService.java    From openAGV with 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 #16
Source File: InheritedChannelNotServerSocket.java    From jdk8u-jdk with 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 #17
Source File: RmiServiceExporter.java    From spring-analysis-note with 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 #18
Source File: RmidViaInheritedChannel.java    From openjdk-jdk8u with 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 #19
Source File: RegistryFilterTest.java    From openjdk-jdk8u with 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 #20
Source File: RegistryFilterTest.java    From openjdk-jdk8u with 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 #21
Source File: RegistryFilterTest.java    From openjdk-jdk8u with 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 #22
Source File: RmidViaInheritedChannel.java    From openjdk-jdk8u-backup with 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 #23
Source File: Activation.java    From openjdk-jdk8u with 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 #24
Source File: Activation.java    From jdk8u60 with 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 #25
Source File: Activation.java    From jdk8u60 with 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 #26
Source File: ServerConnector.java    From ChatRoomFX with MIT License 5 votes vote down vote up
private ServerConnector() throws IOException, NotBoundException {
        Properties properties=new Properties();
//        InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream("settings.properties");
        InputStream input = new FileInputStream(new File("dbSettings/settings.properties"));

        properties.load(input);
//        System.setProperty("java.rmi.server.hostname",properties.getProperty("ip"));
        System.out.println(properties.getProperty("server-ip"));
        controller= (ChatController) Naming.lookup(String.format("rmi://%s:5050/ChatServer", properties.getProperty("server-ip")));

    }
 
Example #27
Source File: RegistryFilterTest.java    From openjdk-jdk8u-backup with 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 #28
Source File: RegistryFilterTest.java    From TencentKona-8 with 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 File: RegistryFilterTest.java    From TencentKona-8 with 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 #30
Source File: RegistryFilterTest.java    From TencentKona-8 with 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");
    }
}