1 Reply Latest reply on Jul 3, 2011 11:50 AM by 793415

    Applet connecting to own host

      I have an applet embedded in a web page which needs to connect to the host where it has been downloaded. The purpose is retrieving a field from a database, so it invokes a script in the host and it expects to have the data returned
      It used to work fine, which is what I would expected from what I have read in every site about applet restrictions: applets are allowed to connect to the host where they have been downloaded
      But since one day on, it started to fail. I get the following exception:

      java.security.AccessControlException: access denied (java.net.SocketPermission 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)

      By tracing the code, I have seen that the exception is yielded in the last call of the following thread:

      objurl = new URL(url);
      HttpURLConnection conn = (HttpURLConnection)objurl.openConnection();
      conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
      conn.setRequestProperty("Content-Length", contentLength);
      OutputStream os = conn.getOutputStream();

      If someone could give me any hint, it will be greatly appreciated
      Thanks in advance