Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

signed applet throws AccessControlException

 
yura volyanskiy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My applet tries to connect to foreign URL, it throws java.security.AccessControlException, though it is signed, certificate is imported in java control panel, connection is created in doPrivileged() function. http://localhost (from where applet is loaded) works OK. Of course, running in appletviewer also works. Here is the error:

http://rambler.ru
java.security.AccessControlException: access denied (java.net.SocketPermission rambler.ru:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at pingviewer.PingApplet$1.run(PingApplet.java:27)
at pingviewer.PingApplet$1.run(PingApplet.java:22)
at java.security.AccessController.doPrivileged(Native Method)
at pingviewer.PingApplet.init(PingApplet.java:21)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Thanks in advance.
[ October 05, 2007: Message edited by: yura volyanskiy ]
 
Suvidha Agarwal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very common problem with the version of jdk 1.4 +
Use policy tool from your command line... and modify the original java.policy file located under /jre/lib/security to add one more permission containing all permisions.

The applets are not permitted to perform priviliged functions like this and thats why the permission has been revoked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic