Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help !!!  RSS feed

 
Eldad Tsipris
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a VERY simple client-server prog.
On localhost it is working great...
once you try to execute the client on other computer I get:
"AccessControlException: access denied (java.net.SocketPermission, IP:5000 connect,resolve)"

Actually it is a very simple chat program taken from "JAVA - how to program" by Deitel& Deitel (chap 17.4)...

How can I overcome this issue?

tnx
Xtrim
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks ike your app does not have the correct permissions set up to connect via the port/connectin it's trying to use.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"xtrim mf",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
Eldad Tsipris
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks ike your app does not have the correct permissions set up to connect via the port/connectin it's trying to use.


tnx for your reply..

How do I do that?
Can't I just "catch" the exception and ignore it?

tnx
Eldad
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eldad Ts:

Can't I just "catch" the exception and ignore it?


Sure, but you won't be connected.
Are you running this code from the command-line?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as i get from the exception, its a problem with the java policy file.
You must put the following entry in the policy file(this can be found at <jre_home>/lib/security/java.policy)

grant {
permission java.net.SocketPermission "<host-address>:<port>", "connect,resolve";
};

Also, look at the javadocs of java.net.SocketPermission to get an idea.
 
Eldad Tsipris
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok...I tried everything....here is the code:


I did all possible combinations to the policy file...

If someone can compile and run it (not from the compilers, because from there it is working...), please let me know how...

tnx
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!