Skip to Main Content

Prob with starting the RMI Server again

User_AYF65Jun 15 2017 — edited Jun 15 2017


I ran a rmi program downloaded from a site. It executed yesterday but today I am trying to run the same program from a different folder but I am getting error in the server:

java HelloServer &

Hello Server failed: access denied ("" "" "connect,resolve")

My interface code is:

import java.rmi.*;

public interface HelloInterface extends Remote {

  public String say(String m) throws RemoteException;


import java.rmi.*;

import java.rmi.server.*;

public class Hello extends UnicastRemoteObject implements HelloInterface {

   private String message; // Strings are serializable

   public Hello (String msg) throws RemoteException {

      message = msg;


   public String say(String m) throws RemoteException {     

      return new StringBuffer(m).reverse().toString()+ "\n" + message;   }}


D:\java prog\2017Self\rmi>javac

import java.rmi.*;

class HelloClient {

   public static void main (String[] args) {


      try {

          if(args.length <0){

System.err.println("Usage: java HelloClient string - \n");



          HelloInterface hello = (HelloInterface)Naming.lookup("//localhost/Hello");


System.out.println(hello.say(args[1]));       }

          catch (Exception e) {

System.out.println("HelloClient exception: " + e);




D:\java prog\2017Self\rmi>javac

import java.rmi.*;

class HelloServer {

   public static void main (String[] argv) {

if(System.getSecurityManager() == null)

System.setSecurityManager(new SecurityManager());

      try {

Naming.rebind("Hello",new Hello("Hello, world!"));

System.out.println("Hello Server is ready.");      }

      catch (Exception e) {

System.out.println("Hello Server failed: " + e);      } }}


D:\java prog\2017Self\rmi>javac

Policy file

Note the name of this file is policy without any extension. Write the following code on notepad editor and then save as “policy”




I have also started the rmiregistry but its running from different window despite I wrote “&” after the command:

rmiregistry &

I don’t know why its occupying the command window even when I am using “&” sign.

Is it required to run the rmiregistry and rmi server from the same command window?

Some body please guide me why I am getting security error?


This post has been answered by User_AYF65 on Jun 15 2017
Jump to Answer
Post Details
Added on Jun 15 2017
1 comment