• Post Reply Bookmark Topic Watch Topic
  • New Topic

exception in Applet (java.net.SocketPermission)  RSS feed

 
Ali Sha
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if an applet named "xyz" which is deployed on Server1 and a client of Server1 access that applet "xyz" which is invoking a servlet from Server2 then why does a scoket exception occure?... following is the code of applet which is deployed on Server1
try {
URL dataURL = null;
URLConnection connection = null;
dataURL = new URL("http://Server2/cFAS/servlet/ServletOpnControl");
System.out.println("...." + dataURL.toString());
connection = dataURL.openConnection();
ObjectInputStream in = new ObjectInputStream(connection.getInputStream());
String[] data1 = (String[]) in.readObject();
in.close();
} catch (Exception mue) {
System.out.println("..."+mue);
}
exception:
java.security.AccessControlException: access denied java.net.SocketPermission kpmg_shm:8080 connect,resolve)
 
Jerry Crone
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The security manager for the applet is preventing you from connecting to a machine other than the one from whence it came. That is a major restriction of applets.
Consider how you could have a servlet on your server forward it to the other server.
 
Suresh Shanmugam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to acheive it without using servlets??
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can digitally sign the applet, and then request permission to make the connection. See, for example, here for information.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!