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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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
s_franklinCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bchristieAuthor Commented:
you caught me. that was in fact a second question.  your response was right on the money.

thanks for the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.