Java Code Examples for java.rmi.RemoteException#printStackTrace()

The following examples show how to use java.rmi.RemoteException#printStackTrace() . These examples are extracted from open source projects. 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
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), impl.checker);

        Echo client = (Echo) ref.exportObject(impl, null, false);

        int count = client.filterCount(obj);
        System.out.printf("count: %d, obj: %s%n", count, obj);
        Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
    } catch (RemoteException rex) {
        if (expectedFilterCount == -1 &&
                UnmarshalException.class.equals(rex.getCause().getClass()) &&
                InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
Example 2
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), impl.checker);

        Echo client = (Echo) ref.exportObject(impl, null, false);

        int count = client.filterCount(obj);
        System.out.printf("count: %d, obj: %s%n", count, obj);
        Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
    } catch (RemoteException rex) {
        if (expectedFilterCount == -1 &&
                UnmarshalException.class.equals(rex.getCause().getClass()) &&
                InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
Example 3
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), impl.checker);

        Echo client = (Echo) ref.exportObject(impl, null, false);

        int count = client.filterCount(obj);
        System.out.printf("count: %d, obj: %s%n", count, obj);
        Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
    } catch (RemoteException rex) {
        if (expectedFilterCount == -1 &&
                UnmarshalException.class.equals(rex.getCause().getClass()) &&
                InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
Example 4
public static void main(String[] ar) {

        ESBJAVA1857TestCase case1 = new ESBJAVA1857TestCase();
        try {
            case1.testSample2();
        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
 
Example 5
Source Project: tlaplus   File: TLCServerMXWrapper.java    License: MIT License 5 votes vote down vote up
public String getSpecName() {
	if (tlcServer.isRunning()) {
		try {
			return tlcServer.getSpecFileName();
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	}
	return "N/A";
}
 
Example 6
Source Project: core   File: ClientFactory.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Just for debugging.
 * 
 * @param args
 */
public static void main(String args[]) {
	String agencyId = "testProjectId";

	Hello hello = ClientFactory.getInstance(agencyId, Hello.class);
	try {
		String result = hello.concat("s1", "s2");
		System.err.println("result=" + result);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example 7
@Override
public I echo(I intf) {
    try {
        return  (I)UnicastRemoteObject
            .exportObject(new C(),0, new CSF(), RMISocketFactory.getDefaultSocketFactory());
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 8
public void report() {
    try {
        System.out.println("Gumball Machine: " + machine.getLocation());
        System.out.println("Current inventory: " + machine.getCount() + " gumballs");
        System.out.println("Current state: " + machine.getState());
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 9
/**
 * {@inheritDoc}
 */
public ErrorEvent getLastError() {
    final RemoteSession session = getSkeleton(sessionID);
    try {
        return session.getLastError();
    } catch (RemoteException e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 10
Source Project: ChatRoomFX   File: ChatRoom.java    License: MIT License 5 votes vote down vote up
public void setUsername(String username){
    this.username=username;
    System.out.println(this.username);
    try {
        controller.updateClientList();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 11
@Test
public void testRangeFunc() throws RemoteException {
    List<Stock> stocks = TestCaseGenerator.generateStocks();
    StockToStockWithShareHolderTrendMapper mapper = new StockToStockWithShareHolderTrendMapper();

    int count1 = stocks.stream()
            .map(mapper.andThen(Stock::getShareHoldersTrend).andThen(Trend::getHistory))
            .mapToInt(List::size).reduce(Integer::sum).getAsInt();

    Calendar calendar = Calendar.getInstance();
    calendar.set(2014, Calendar.AUGUST, 5);
    Date since = calendar.getTime();

    calendar.set(2015, Calendar.MAY, 28);
    Date until = calendar.getTime();

    StockToStockWithShareHolderTrendMapper rangeMapper =
            null;
    try {
        rangeMapper = new StockToStockWithShareHolderTrendMapper(since, until);
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    int count2 = stocks.stream()
            .map(rangeMapper.andThen(Stock::getShareHoldersTrend).andThen(Trend::getHistory))
            .mapToInt(List::size).reduce(Integer::sum).getAsInt();

    Assert.assertTrue(count2 < count1);

}
 
Example 12
@Override
public boolean canDeleteQualifier(long qualifierId) {
    try {
        return deligate.canDeleteQualifier(qualifierId);
    } catch (RemoteException e) {
        remoteException(e);
        e.printStackTrace();
        throw new ClientException(e);
    }
}
 
Example 13
Source Project: tomee   File: StatefulEjbObjectTests.java    License: Apache License 2.0 5 votes vote down vote up
public void test05_remove() {
    String str = null;
    try {
        str = ejbObject.remove("Hello");
    } catch (final RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    assertEquals("Hello", str);
}
 
Example 14
@Override
public Object invoke(Object proxy, Method method, Object[] args)
        throws Throwable {

    MethodHolder methodHolder = new MethodHolder(method.getName(),
            (args == null) ? 0 : args.length);

    Object object = hashtable.get(methodHolder);
    if (object != null) {
        return method.invoke(object, args);
    }

    CallParameters parameters = new CallParameters(method.getName(), args);

    try {
        CallResult result;
        result = invocker.invoke(parameters);

        for (EventHolder holder : result.holder.getEvents()) {
            callEvent(holder, true);
        }

        if (result.exception != null)
            throw result.exception;
        return result.result;
    } catch (RemoteException e) {
        e.printStackTrace();
        remoteException(e);
    }
    return null;
}
 
Example 15
Source Project: tomee   File: StatelessEjbObjectTests.java    License: Apache License 2.0 5 votes vote down vote up
public void test06_remove() {
    String str = null;
    try {
        str = ejbObject.remove("Hello");
    } catch (final RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    assertEquals("Hello", str);
}
 
Example 16
public static void main(String[] args) throws Exception {

        int errorCount = 0;

        MapNullValuesTest test = new MapNullValuesTest();

        // Create an RMI registry
        //
        echo("");
        echo(dashedMessage("Start RMI registry"));
        Registry reg = null;
        port = 7500;
        while (port++ < 7550) {
            try {
                reg = LocateRegistry.createRegistry(port);
                echo("\nRMI registry running on port " + port);
                break;
            } catch (RemoteException e) {
                // Failed to create RMI registry...
                //
                echo("\nFailed to create RMI registry on port " + port);
                e.printStackTrace(System.out);
            }
        }
        if (reg == null) {
            System.exit(1);
        }

        // Run tests
        //
        errorCount += test.mapToHashtableTests();
        errorCount += test.jmxConnectorServerFactoryTests();
        errorCount += test.jmxConnectorFactoryTests();
        errorCount += test.nullKeyFactoryTests();

        if (errorCount == 0) {
            echo("\nNull values for key/value pairs in Map Tests PASSED!");
        } else {
            echo("\nNull values for key/value pairs in Map Tests FAILED!");
            System.exit(1);
        }
    }
 
Example 17
public static void main(String[] args) throws Exception {

        int errorCount = 0;

        MapNullValuesTest test = new MapNullValuesTest();

        // Create an RMI registry
        //
        echo("");
        echo(dashedMessage("Start RMI registry"));
        Registry reg = null;
        port = 7500;
        while (port++ < 7550) {
            try {
                reg = LocateRegistry.createRegistry(port);
                echo("\nRMI registry running on port " + port);
                break;
            } catch (RemoteException e) {
                // Failed to create RMI registry...
                //
                echo("\nFailed to create RMI registry on port " + port);
                e.printStackTrace(System.out);
            }
        }
        if (reg == null) {
            System.exit(1);
        }

        // Run tests
        //
        errorCount += test.mapToHashtableTests();
        errorCount += test.jmxConnectorServerFactoryTests();
        errorCount += test.jmxConnectorFactoryTests();
        errorCount += test.nullKeyFactoryTests();

        if (errorCount == 0) {
            echo("\nNull values for key/value pairs in Map Tests PASSED!");
        } else {
            echo("\nNull values for key/value pairs in Map Tests FAILED!");
            System.exit(1);
        }
    }
 
Example 18
public static void main(String[] args) throws Exception {

        int errorCount = 0;

        MapNullValuesTest test = new MapNullValuesTest();

        // Create an RMI registry
        //
        echo("");
        echo(dashedMessage("Start RMI registry"));
        Registry reg = null;
        port = 7500;
        while (port++ < 7550) {
            try {
                reg = LocateRegistry.createRegistry(port);
                echo("\nRMI registry running on port " + port);
                break;
            } catch (RemoteException e) {
                // Failed to create RMI registry...
                //
                echo("\nFailed to create RMI registry on port " + port);
                e.printStackTrace(System.out);
            }
        }
        if (reg == null) {
            System.exit(1);
        }

        // Run tests
        //
        errorCount += test.mapToHashtableTests();
        errorCount += test.jmxConnectorServerFactoryTests();
        errorCount += test.jmxConnectorFactoryTests();
        errorCount += test.nullKeyFactoryTests();

        if (errorCount == 0) {
            echo("\nNull values for key/value pairs in Map Tests PASSED!");
        } else {
            echo("\nNull values for key/value pairs in Map Tests FAILED!");
            System.exit(1);
        }
    }
 
Example 19
public static void main(String[] args) throws Exception {

        int errorCount = 0;

        MapNullValuesTest test = new MapNullValuesTest();

        // Create an RMI registry
        //
        echo("");
        echo(dashedMessage("Start RMI registry"));
        Registry reg = null;
        port = 7500;
        while (port++ < 7550) {
            try {
                reg = LocateRegistry.createRegistry(port);
                echo("\nRMI registry running on port " + port);
                break;
            } catch (RemoteException e) {
                // Failed to create RMI registry...
                //
                echo("\nFailed to create RMI registry on port " + port);
                e.printStackTrace(System.out);
            }
        }
        if (reg == null) {
            System.exit(1);
        }

        // Run tests
        //
        errorCount += test.mapToHashtableTests();
        errorCount += test.jmxConnectorServerFactoryTests();
        errorCount += test.jmxConnectorFactoryTests();
        errorCount += test.nullKeyFactoryTests();

        if (errorCount == 0) {
            echo("\nNull values for key/value pairs in Map Tests PASSED!");
        } else {
            echo("\nNull values for key/value pairs in Map Tests FAILED!");
            System.exit(1);
        }
    }
 
Example 20
public static void main(String[] args) throws Exception {

        int errorCount = 0;

        MapNullValuesTest test = new MapNullValuesTest();

        // Create an RMI registry
        //
        echo("");
        echo(dashedMessage("Start RMI registry"));
        Registry reg = null;
        port = 7500;
        while (port++ < 7550) {
            try {
                reg = LocateRegistry.createRegistry(port);
                echo("\nRMI registry running on port " + port);
                break;
            } catch (RemoteException e) {
                // Failed to create RMI registry...
                //
                echo("\nFailed to create RMI registry on port " + port);
                e.printStackTrace(System.out);
            }
        }
        if (reg == null) {
            System.exit(1);
        }

        // Run tests
        //
        errorCount += test.mapToHashtableTests();
        errorCount += test.jmxConnectorServerFactoryTests();
        errorCount += test.jmxConnectorFactoryTests();
        errorCount += test.nullKeyFactoryTests();

        if (errorCount == 0) {
            echo("\nNull values for key/value pairs in Map Tests PASSED!");
        } else {
            echo("\nNull values for key/value pairs in Map Tests FAILED!");
            System.exit(1);
        }
    }