Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

exception in Applet (java.net.SocketPermission)

 
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)
 
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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to acheive it without using servlets??
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • 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.
 
permaculture is largely about replacing oil with people. And one tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic