Java Code Examples for java.rmi.AlreadyBoundException
The following examples show how to use
java.rmi.AlreadyBoundException. 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
Source Project: JavaRushTasks Source File: Solution.java License: MIT License | 6 votes |
@Override public void run() { //напишите тут ваш код try { //создание объекта для удаленного доступа final Animal cat = new Cat("Barsik"); final Animal dog = new Dog("Palkan"); //создание реестра расшареных объетов registry = LocateRegistry.createRegistry(2099); //создание "заглушки" – приемника удаленных вызовов Remote stubCat = UnicastRemoteObject.exportObject(cat, 0); Remote stubDog = UnicastRemoteObject.exportObject(dog, 0); //регистрация "заглушки" в реесте registry.bind(BINDING_NAME1, stubCat); registry.bind(BINDING_NAME2, stubDog); } catch (RemoteException | AlreadyBoundException e) { e.printStackTrace(); } }
Example 2
Source Project: scheduling Source File: RMTHelper.java License: GNU Affero General Public License v3.0 | 6 votes |
/** * Create several nodes on the same JVMProcess */ public static List<TestNode> createNodes(final String nodeName, int number) throws IOException, NodeException, ExecutionException, InterruptedException, AlreadyBoundException { if (number == 0) { throw new IllegalArgumentException("" + number); } ArrayList<TestNode> nodes = new ArrayList<>(number); // Start the JVMProcess and create the first node TestNode node0 = createNode(nodeName + 0, findFreePort()); nodes.add(0, node0); // create all subsequent nodes remotely for (int i = 1; i < number; i++) { Node nodei = node0.getNode().getProActiveRuntime().createLocalNode(nodeName + i, false, null); nodes.add(new TestNode(node0.getNodeProcess(), nodei)); } return nodes; }
Example 3
Source Project: JavaTutorial Source File: RmiServer.java License: Apache License 2.0 | 6 votes |
/** * @param args [0]:绑定端口 * @throws RemoteException */ public static void main(String[] args) throws RemoteException { int port = Integer.parseInt(args[0]); UserService userService = new UserServiceImpl(); Registry registry = createRegistry(port); if (null == registry) { System.exit(0); } String bindName = "UserService"; try { registry.bind(bindName, userService); } catch (AlreadyBoundException e) { _logger.info("服务{}已经绑定过", bindName); } _logger.info("RMI Server started, listen port:{}", port); }
Example 4
Source Project: dragonwell8_jdk Source File: Activation.java License: GNU General Public License v2.0 | 5 votes |
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { if (name.equals(NAME)) { throw new AccessException( "binding ActivationSystem is disallowed"); } else { RegistryImpl.checkAccess("ActivationSystem.bind"); super.bind(name, obj); } }
Example 5
Source Project: dragonwell8_jdk Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 6
Source Project: dragonwell8_jdk Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 7
Source Project: dragonwell8_jdk Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 8
Source Project: dragonwell8_jdk Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 9
Source Project: TencentKona-8 Source File: Activation.java License: GNU General Public License v2.0 | 5 votes |
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { if (name.equals(NAME)) { throw new AccessException( "binding ActivationSystem is disallowed"); } else { RegistryImpl.checkAccess("ActivationSystem.bind"); super.bind(name, obj); } }
Example 10
Source Project: TencentKona-8 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 11
Source Project: TencentKona-8 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 12
Source Project: TencentKona-8 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 13
Source Project: TencentKona-8 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 14
Source Project: jdk8u60 Source File: Activation.java License: GNU General Public License v2.0 | 5 votes |
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { if (name.equals(NAME)) { throw new AccessException( "binding ActivationSystem is disallowed"); } else { super.bind(name, obj); } }
Example 15
Source Project: openjdk-jdk8u Source File: Activation.java License: GNU General Public License v2.0 | 5 votes |
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { if (name.equals(NAME)) { throw new AccessException( "binding ActivationSystem is disallowed"); } else { RegistryImpl.checkAccess("ActivationSystem.bind"); super.bind(name, obj); } }
Example 16
Source Project: openjdk-jdk8u Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 17
Source Project: openjdk-jdk8u Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 18
Source Project: openjdk-jdk8u Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 19
Source Project: openjdk-jdk8u Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 20
Source Project: BaRMIe Source File: IllegalRegistryBind.java License: MIT License | 5 votes |
/******************* * Check if the given endpoint can be attacked. * * This check is performed by executing a dummy attack against the * endpoint and observing the resulting exception. * * @param ep An enumerated RMI endpoint. * @return True if we can attack it. ******************/ public boolean canAttackEndpoint(RMIEndpoint ep) { RMIBindExploitProxy proxy = null; Registry reg; //Execute a dummy attack try { //Start a bind exploit proxy proxy = new RMIBindExploitProxy(InetAddress.getByName(ep.getEndpoint().getHost()), ep.getEndpoint().getPort(), this._options, this._dummyPayload); proxy.startProxy(); //Get a proxied RMI registry reference reg = LocateRegistry.getRegistry(proxy.getServerListenAddress().getHostAddress(), proxy.getServerListenPort()); //Bind a dummy object in an attempt to trigger the vulnerability reg.bind(this.generateRandomString(), new BaRMIeBindExploit()); } catch(BaRMIeException | UnknownHostException | RemoteException | AlreadyBoundException ex) { //An up to date RMI registry will, by default, reject the dummy object if(ex instanceof ServerException && ex.getCause() != null && ex.getCause() instanceof UnmarshalException && ex.getCause().getCause() != null && ex.getCause().getCause() instanceof InvalidClassException) { //Check for "filter status: REJECTED" if(ex.getCause().getCause().toString().contains("filter status: REJECTED")) { //Test payload was filtered, likely this attack isn't possible return false; } } } finally { //Stop the proxy if(proxy != null) { proxy.stopProxy(true); } } //In all other cases we should be able to attack the registry return true; }
Example 21
Source Project: openjdk-jdk8u-backup Source File: Activation.java License: GNU General Public License v2.0 | 5 votes |
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { if (name.equals(NAME)) { throw new AccessException( "binding ActivationSystem is disallowed"); } else { RegistryImpl.checkAccess("ActivationSystem.bind"); super.bind(name, obj); } }
Example 22
Source Project: openjdk-jdk8u-backup Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 23
Source Project: openjdk-jdk8u-backup Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 24
Source Project: openjdk-jdk8u-backup Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 25
Source Project: openjdk-jdk8u-backup Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 26
Source Project: openjdk-jdk9 Source File: Activation.java License: GNU General Public License v2.0 | 5 votes |
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException { if (name.equals(NAME)) { throw new AccessException( "binding ActivationSystem is disallowed"); } else { RegistryImpl.checkAccess("ActivationSystem.bind"); super.bind(name, obj); } }
Example 27
Source Project: openjdk-jdk9 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 Project: openjdk-jdk9 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 29
Source Project: openjdk-jdk9 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 Project: openjdk-jdk9 Source File: RegistryFilterTest.java License: GNU General Public License v2.0 | 5 votes |
@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 } }