Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RemoteException  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run a basic RMI application.
When I try to run the RMI server I am getting this error.
Exception occurred: java.rmi.RemoteException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
What am I doing wrong.Please help.
 
Herbert Maosa
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, that makes the two of us. I am also getting exactly the same message and moreinterestingly the my host address is exactly like yours. I am trying to use my localhost, are using localhost as well ? Do all localhosts have this address ?
Let hope someone will explain this soon. Meanwhile I will try to figure it out.
Herbert.
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Herbert,
Can you please tell me which tutorial are you trying to run? Looks like AccessException is being thrown by Naming class. Did you specify the security policy?
Regards,
Milind
 
Herbert Maosa
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Milind,
Actually I am not using an example from a tutorial. I just created my own classes as I understood the various tutorials. You are right that this exception is being thrown by invoking Naming.rebind() because I am able to catch it there. I ofcourse set the security Manager with System.setSecurityManager(new RMISecurityManager()) and it does not help. I even tried to write my own policy file and run the server with the -Djava option but I am not winning.I struggling right now to figure it out but I dont seem to make any progress yet....
Herbert.
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Herbert,
I had encountered a similar exception when I had specified localhost in Naming class and had my internet on. I switched off my net connection and recompiled all the files and it worked for me. I don't no the exact reason but it worked for me...
Milind
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JBuilder3.5 Foundation edition and am trying to run the sample RMI project.I am getting the error when I use the Naming.rebind command.I have tried all possible ways either connecting or not connecting to internet.But it does'nt seem to work.
BY the way can anybody provide the policy file for a windows environment.How should I specify the policy file if I write the program using JDK1.2
Hope somebody gives a solution.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you are running on NT, i would do a find to see if you have multiple copies of java.policy file lying around. If so, make sure they are in sync(use default permission all) and then try it again.
 
Herbert Maosa
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it to work. I have had to learn the following few facts.
1.JDK1.1 trusts code in the classpath and such RMI connections can be made in JDK1.1 without the programmer having to supply a policy file that enables certain operations.
2.JDK1.2 is stiffer and you ALWAYS have to supply a policy file.This policy file will have the rules about SocketPermission, file io etc.
Since I am using my local machine for both server and client I trusted myself and granted myself freedom to all operations.
Regards,
Herbert.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please explain the steps for getting RMI to work.
i.e., how to specify the policy file,which directory should the policy file be,the commands etc.,
Thanks
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Check out the tutorial here:
http://www.execpc.com/~gopalan/java/java_rmi.html
Each and every step is explained with a small example here.
Regards,
Milind
 
AJ Dussault
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Herbert,
>>more interestingly the my host address is exactly like yours. I am trying to use my localhost, are using localhost as well ? Do all localhosts have this address ?<<
127.0.0.1 is a generic loop-back ip address for your computer. Yep, all localhosts use this ip address for themselves. Someone correct me if I am wrong, but I think this is correct...
AJ

 
Herbert Maosa
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aj Dussualt,
Actually you are very right to say that the IP address 127.0.0.1 is a generic loopback IP address that only connects back to the same machine.Just found that out a few days ago.Thanks

Herbert
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!