Link to home
Start Free TrialLog in
Avatar of bchristie
bchristie

asked on

RMI

I am trying to run the sample RMI program at.

http://java.sun.com/docs/books/tutorial/rmi/index.html

when i try to run the server i get the following error.

Exception occurred: java.rmi.RemoteException: access denied (java.net.SocketPerm
ission 127.0.0.1:1099 connect,resolve)

I suspect that the problem doe not lie in the code itself as the code was taken
verbatiom from the sun site.  I also get the same error when i run another borland example.  any ideas?

Thanks
Bruce
Avatar of s_franklin
s_franklin

Did you setup a policy file as suggested at:

http://java.sun.com/docs/books/tutorial/rmi/running.html

Look at the "note about security"... It provided a sample policy file for you to start with:

http://java.sun.com/docs/books/tutorial/rmi/example-1dot2/java.policy

Steve
Avatar of bchristie

ASKER

Thanks s_franklin,

That seems to have solved part of the problem.  In the existing java.policy file commented out the old permission
and replaced it with the following.

      //permission java.net.SocketPermission "localhost:1024-", "listen";
        permission java.net.SocketPermission "*:1024-65535", "connect,accept,listen";
        permission java.net.SocketPermission "*:80", "connect";


I now get the error

java.rmi.ConnectException: Connection refused to host:

Are there other settings I need to change?






Hey that's a second question :)

Did you start your rmiregistry? That's a standard error you will get when you try to bind to the nameserver if it is not running. That's mentioned in the documents as the step you run prior to starting up the server - i.e. rmiregistry & if you're in a unix environment.

Steve
Do you have a firewall or any other network restrictions that may be stopping the connection on this socket?

Network security often means that connections to some servers on sockets other than those specified by the firewall will not be allowed for instance.
ASKER CERTIFIED SOLUTION
Avatar of s_franklin
s_franklin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you caught me. that was in fact a second question.  your response was right on the money.

thanks for the help.