Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes 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
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
master stewards:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
garden masters:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
gardeners:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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 giving a gift to your future self. After reading this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!