• Post Reply Bookmark Topic Watch Topic
  • New Topic

access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)

 
k mull
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've read so many posts about this problem already all over the net but I still cant fix mine. Basically I get this error everytime I run the client
"Exception Error: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)"

This is the code in MyClient.java:


It's the SecutiryManager() line's that are the problem..

I have created a policy file which looks like this:
grant {
permission java.security.AllPermission;
};

When I run the Server this is what I type:
java -Djava.security.policy="file:///C:\ds\rmi\dsproj.policy" ComputeServer

This is the code for my ComputeServer.java:


Whenever I run the client I get that error above and I have no idea how to fix it..Can someone please help?? Thanks...

 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try specifying the java.security.policy property as just a file name instead of a URL -
 
k mull
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have..I've tried many different variations of that line but none of them seem to work!

Thanks anyway...
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, Sorry... realized I needed to read closer...

You gave the command line for your server, but mentioned you are getting the error on your client - are you specifying the policy file property the same way on the client command line?

Also, if this doesn't work, try using -
 
k mull
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks so much - i guess i shoulda copped that i needed to specify the policy file when running the client from the command line..duh!!

thanks again...

could i ask one more thing? this is prolly a really stupid question, but i'm new to RMI and i'm not sure about this so..

I have a Client and a Server (obviously)
I have a Task interface and a FibonacciTask class, a FactorialTask class and a PrimeTask class which all implement Task...

In the Task interface there is a method called calculate( Task t ) which returns a type Object..

So what the client does is it passes the object to be 'calcualted' to the server and server runs the method calculate ( Task t ) on the server-side and passes back an Object to the client..does that make sense? I hope so..

When I do this i get the following error:
RemoteException Error: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: FibonacciTask (no security manager: RMI class loader disabled)

I dont really know how to fix this error, but if I put the FibonacciTask.class file into the folder where my server is ( seperate folder for the client files ) the calculate() method will run and return an Object to the client..but I figure that the FibonacciTask.class file should not be in with the server files - that's the whole point of RMI right!? SO..have you any suggestions on how to fix this...thanks so much for your help so far!!!
[ March 30, 2005: Message edited by: k mull ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this reference - Dynamic code downloading using RMI

Also, since your trace includes the text "no security manager: RMI class loader disabled", it sounds like you need to set the RMISecurityManager in the server too.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!