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
bchristieAsked:
Who is Participating?
 
s_franklinConnect With a Mentor Commented:
Also, you will want to sure that you have your paths reconciled properly between your java.policy file (you have "*" so you should be okay there), the path specified for the String "name", i.e. "//your.machine.here/Compute", and the java.rmi.server.hostname define which you have specified when you start up your server. I have two shell scripts for starting up the server and client.

Server:
rmiregistry &
export CLASSPATH="c:/Demo;d:/Work/SearchWeb/classes/compute.jar"
//d/jdk1.2.2/bin/java \
-Djava.rmi.server.codebase=file:/d:/Work/HTML/classes/ \
-Djava.rmi.server.hostname=franklin \
-Djava.security.policy=java.policy engine.ComputeEngine

Client:
export CLASSPATH="c:/Demo;d:/Work/SearchWeb/HTML/classes/compute.jar"
//d/jdk1.2.2/bin/java \
-Djava.rmi.server.codebase=file:/d:/Work/SearchWeb/classes \
-Djava.security.policy=java.policy \
client.ComputePi localhost 20

I'm using cygwin (unix utilities port to Windows) so my paths look a bit funny (//d/path/here instead of /path/here or d:\path\here).

Steve
0
 
s_franklinCommented:
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
0
 
bchristieAuthor Commented:
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?






0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
s_franklinCommented:
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
0
 
JodCommented:
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.
0
 
bchristieAuthor Commented:
you caught me. that was in fact a second question.  your response was right on the money.

thanks for the help.
0
All Courses

From novice to tech pro — start learning today.