• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

exception???  RSS feed

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i get an exception in the code.
it is like this...
java.security.AccesControlException access denied
(java.net.socketpermission 192.168.1.107 :1099 connect,resolve)
here 192.168.1.107 is the server's IP address.i am running the client
in another machine.i wrote a policy file granting ALLpermission.
the error is in client machine.

please give me a solution
regards
srijan
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you use java -Djava.security.policy=permission.txt option?
 
srijan sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
no i did not try with that. i will try and inform
regards
 
srijan sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
the detailed problem is
The server runs on a machine other than the client.I try to send
a message from the client, process it in the server and get back
the result into the client applet.The outline is like this.
Server machine IP : 192.168.1.107
Server side:
At the command line I type:
C:\start rmiregistry
C:\java -Djava.security.policy=grantperm.policy AddServer

both the rmiregistry and the server start up fine.
Client side IP :192.168.1.110)
At the command line I type:
C:\appletviewer AddClient.java
the applet starts up but as soon as the contents of the applet are
displayed the following exception comes at the client machine:
java.net.AccessControlexception access denied (java.net.SocketPermission
192.168.1.107:1099 connect,resolve)
there is no other further action at the client.
the server is still running fine
can u please explain why this happens.the 'grantperm policy' file contains:
grant
{ // allow everything for now
permission java.security.AllPermission;
};
and is in the same directory as the AddServerImpl and AddServer files.
 
srijan sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
the detailed problem is
The server runs on a machine other than the client.I try to send
a message from the client, process it in the server and get back
the result into the client applet.The outline is like this.
Server machine IP : 192.168.1.107
Server side:
At the command line I type:
C:\start rmiregistry
C:\java -Djava.security.policy=grantperm.policy AddServer

both the rmiregistry and the server start up fine.
Client side IP :192.168.1.110)
At the command line I type:
C:\appletviewer AddClient.java
the applet starts up but as soon as the contents of the applet are
displayed the following exception comes at the client machine:
java.net.AccessControlexception access denied (java.net.SocketPermission
192.168.1.107:1099 connect,resolve)
there is no other further action at the client.
the server is still running fine
can u please explain why this happens.the 'grantperm policy' file contains:
grant
{ // allow everything for now
permission java.security.AllPermission;
};
and is in the same directory as the AddServerImpl and AddServer files.

srijan
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The problem you are facing is due to the Applet security restrictions. The Applet Security Manager allows socket connections to the same machine (i.e. same IP address) from where the applet was loaded. Thus, if you have a RMI server on a different machine than the webserver machine (from where the applet was loaded), there is a security exception thrown.
However, you can sign your applets and relax this rule. I think you can use javakey to sign it. But, this is only for development environment. Coz, IE and Netscape do not recognize it.
Hope this helps.
Ashwin.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!