16575

java applet java.security.AccessControlException: access denied java.net.SocketPermission

Question:

I friend of mine gave me a script to run minecraft skins on my site but i keep getting this error and i dont have any clue how to go about this... =( <a href="http://allcitybuilder.com/new/example.html" rel="nofollow">http://allcitybuilder.com/new/example.html</a>

java.security.AccessControlException: access denied (java.net.SocketPermission www.minecraft.net: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.plugin2.applet.Applet2SecurityManager.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 net.minecraft.skintest.math.Zombie$1.run(Zombie.java:82)

Answer1:

You must allow the Applet to connect to a resource.

Have a look at the sigend Applet tutorial: <a href="http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-applet.html" rel="nofollow">http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-applet.html</a>

Answer2:

Normally Applets are only allowed to access the host they came from (in your case allcitybuilder.com). Thus, you either have to put the file to view also to this host (or install a proxy there), or your applet needs additional privileges to have more access.

For the applet to have more access, it needs to be digitally signed, and the user needs to confirm the applet loading.

But there is no way to say "I need only access to minecraft.net" and for the user to grant you only this permission (without manual editing of policy files), so it is an "all or nothing". Also, if the user refuses, the applet may either run with usual applet permissions (on Sun's Plugin) or not run at all (on IcedTea).

With JNLP you can get a confirmation for the user for individual actions, but this is only for local access, no remote one.

Answer3:

Probably the easiest thing would be to copy the resources to your site, making sure you have been granted appropriate rights by the copyright holder.

Alternatively, the site may add a crossdomain.xml file to allow access to code loaded from non-same-origin sites.

It is possibly to sign the code to gain full access to the local machine. However, this requires the user to accept the risk and writing secure code is surprisingly difficult.

Recommend

  • Getting MalformedChunkCodingException while reading JSON data
  • Java Applet work only on my computer?
  • ClassNotFoundException only if JAR is signed
  • How to deploy folder which is not included while publishing to Azure
  • Showing Error :Attempt to invoke interface method 'int java.util.List.size()' on a null ob
  • parent selector in less
  • How to use JAXB with HTML?
  • Error: Wrapper cannot find servlet class VendorRegistration or a class it depends on
  • Missing OpenFilesEvent for JavaFX on Mac
  • How does a browser handle cookie with no path and no domain
  • Using JNA to Get NSWindow from JComponent on mac
  • How to print a java String in a jsp file [duplicate]
  • How do I get sun webserver to redirect from /
  • Drag and Drop between different layout units in Primefaces
  • How do i do the following curl command in Java
  • Exclusive access established by another Thread Java smartcardio
  • PHP problems with current url
  • wsContext.getMessageContext().get(MessageContext.SERVLET_REQUEST) returns null on Jetty?
  • PHP: Get HTTP Protocol Version (HTTP/1.1 vs HTTP/2)
  • UIImagePickerControllerDelegate Methods Not Called When Delegate Not UIViewController
  • Base64 as method of sanitizing user input for Mysql
  • 3.0.0.M1: SSL - Invalid keystore format
  • JConsole Main class
  • JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8 throws Unexpected call to method or p
  • rewrite uppercase url to lowercase url htaccess
  • HttpURLConnection.getOutputStream() takes 20 seconds. Why?
  • Jetty 9 HashLoginService
  • Pass value from viewmodel to script in zk
  • Java applet as stand-alone Windows application?
  • Eraser for UIBezierPath
  • Compare two NSDates in iPhone
  • Load html files in TinyMce
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal