Search in sources :

Example 11 with RemoteException

use of java.rmi.RemoteException in project neo4j by neo4j.

the class GraphDatabaseShellServer method welcome.

@Override
public Welcome welcome(Map<String, Serializable> initialSession) throws RemoteException, ShellException {
    try (org.neo4j.graphdb.Transaction transaction = graphDb.beginTx()) {
        Welcome welcome = super.welcome(initialSession);
        transaction.success();
        return welcome;
    } catch (RuntimeException e) {
        throw new RemoteException(e.getMessage(), e);
    }
}
Also used : Welcome(org.neo4j.shell.Welcome) RemoteException(java.rmi.RemoteException)

Example 12 with RemoteException

use of java.rmi.RemoteException in project neo4j by neo4j.

the class StartClientIT method shouldNotStartBolt.

@Test
public void shouldNotStartBolt() throws IOException {
    // Given
    AssertableLogProvider log = new AssertableLogProvider();
    // When
    new StartClient(System.out, System.err) {

        @Override
        protected GraphDatabaseShellServer getGraphDatabaseShellServer(File path, boolean readOnly, String configFile) throws RemoteException {
            return new GraphDatabaseShellServer(new TestGraphDatabaseFactory().setUserLogProvider(log), path, readOnly, configFile);
        }
    }.start(new String[] { "-c", "RETURN 1;", "-path", db.getStoreDir(), "-config", getClass().getResource("/config-with-bolt-connector.conf").getFile() }, mock(CtrlCHandler.class));
    // Then
    log.assertNone(inLog(startsWith(WorkerFactory.class.getPackage().getName())).any());
}
Also used : GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RemoteException(java.rmi.RemoteException) File(java.io.File) WorkerFactory(org.neo4j.bolt.v1.runtime.WorkerFactory) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Example 13 with RemoteException

use of java.rmi.RemoteException in project roboguice by roboguice.

the class ThrowingProviderTest method testProviderMethodWithManyExceptions.

public void testProviderMethodWithManyExceptions() {
    try {
        Guice.createInjector(new AbstractModule() {

            protected void configure() {
                install(ThrowingProviderBinder.forModule(this));
            }

            @SuppressWarnings("unused")
            @CheckedProvides(RemoteProvider.class)
            String foo() throws InterruptedException, RuntimeException, RemoteException, AccessException, TooManyListenersException {
                return null;
            }
        });
        fail();
    } catch (CreationException ce) {
        // The only two that should fail are Interrupted & TooManyListeners.. the rest are OK.
        List<Message> errors = ImmutableList.copyOf(ce.getErrorMessages());
        assertEquals(InterruptedException.class.getName() + " is not compatible with the exceptions ([" + RemoteException.class + "]) declared in the CheckedProvider interface (" + RemoteProvider.class.getName() + ")", errors.get(0).getMessage());
        assertEquals(TooManyListenersException.class.getName() + " is not compatible with the exceptions ([" + RemoteException.class + "]) declared in the CheckedProvider interface (" + RemoteProvider.class.getName() + ")", errors.get(1).getMessage());
        assertEquals(2, errors.size());
    }
}
Also used : TooManyListenersException(java.util.TooManyListenersException) AccessException(java.rmi.AccessException) CreationException(com.google.inject.CreationException) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) RemoteException(java.rmi.RemoteException) AbstractModule(com.google.inject.AbstractModule)

Example 14 with RemoteException

use of java.rmi.RemoteException in project spring-framework by spring-projects.

the class ThrowsAdviceInterceptorTests method testHandlerMethodThrowsException.

@Test
public void testHandlerMethodThrowsException() throws Throwable {
    final Throwable t = new Throwable();
    @SuppressWarnings("serial") MyThrowsHandler th = new MyThrowsHandler() {

        @Override
        public void afterThrowing(RemoteException ex) throws Throwable {
            super.afterThrowing(ex);
            throw t;
        }
    };
    ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
    // Extends RemoteException
    ConnectException ex = new ConnectException("");
    MethodInvocation mi = mock(MethodInvocation.class);
    given(mi.proceed()).willThrow(ex);
    try {
        ti.invoke(mi);
        fail();
    } catch (Throwable caught) {
        assertEquals(t, caught);
    }
    assertEquals(1, th.getCalls());
    assertEquals(1, th.getCalls("remoteException"));
}
Also used : MethodInvocation(org.aopalliance.intercept.MethodInvocation) RemoteException(java.rmi.RemoteException) ConnectException(java.rmi.ConnectException) Test(org.junit.Test)

Example 15 with RemoteException

use of java.rmi.RemoteException in project spring-framework by spring-projects.

the class RmiRegistryFactoryBean method getRegistry.

/**
	 * Locate or create the RMI registry.
	 * @param registryPort the registry port to use
	 * @return the RMI registry
	 * @throws RemoteException if the registry couldn't be located or created
	 */
protected Registry getRegistry(int registryPort) throws RemoteException {
    if (this.alwaysCreate) {
        logger.info("Creating new RMI registry");
        this.created = true;
        return LocateRegistry.createRegistry(registryPort);
    }
    if (logger.isInfoEnabled()) {
        logger.info("Looking for RMI registry at port '" + registryPort + "'");
    }
    synchronized (LocateRegistry.class) {
        try {
            // Retrieve existing registry.
            Registry reg = LocateRegistry.getRegistry(registryPort);
            testRegistry(reg);
            return reg;
        } catch (RemoteException ex) {
            logger.debug("RMI registry access threw exception", ex);
            logger.info("Could not detect RMI registry - creating new one");
            // Assume no registry found -> create new one.
            this.created = true;
            return LocateRegistry.createRegistry(registryPort);
        }
    }
}
Also used : LocateRegistry(java.rmi.registry.LocateRegistry) LocateRegistry(java.rmi.registry.LocateRegistry) Registry(java.rmi.registry.Registry) RemoteException(java.rmi.RemoteException)

Aggregations

RemoteException (java.rmi.RemoteException)368 IOException (java.io.IOException)54 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)38 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)34 SSOException (com.iplanet.sso.SSOException)32 AMException (com.iplanet.am.sdk.AMException)31 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)29 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)29 AMEventManagerException (com.iplanet.am.sdk.AMEventManagerException)29 LocateRegistry (java.rmi.registry.LocateRegistry)29 Registry (java.rmi.registry.Registry)29 UnsupportedEncodingException (java.io.UnsupportedEncodingException)27 EJBException (javax.ejb.EJBException)25 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)24 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)24 ArrayList (java.util.ArrayList)22 InvocationTargetException (java.lang.reflect.InvocationTargetException)21 ConnectException (java.net.ConnectException)20 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)18 ExecutionException (com.cloud.utils.exception.ExecutionException)18