0

It was working fine with JDK 1.7 or earlier versions, but once we test with JDK 8 we are getting the following exception

Exception in thread "cth" java.security.AccessControlException: access denied              ("java.net.SocketPermission" "IP:PORT" "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.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at iyp.simplegameapplet.d.f.a(Unknown Source)
at iyp.b.a.b$c.run(Unknown Source)

We have an applet, which will open a socket connection to communicate with the server socket application here is the applet code which used to open the socket communication

Socket sock = new Socket();
InputStream is;
OutputStream os;
try {
    sock.connect(serverAddr, timeoutMs);
} catch(SocketTimeoutException ex) {
    return false;
}
is = sock.getInputStream();
os = sock.getOutputStream();

We are using signed applets. any help will be appreciated...

Rajendar Reddy
  • 406
  • 3
  • 3

1 Answers1

0

there is a clue right at the top, Exception in thread "cth" java.security.AccessControlException: access denied. The code snipit that you posted is fine but we would need to see it in better detail to find out why access is being denied.

  • Thanks for the update, with the exception is understand that the socket is not able to communicate with server due the permissions, but I have used java.policy file at serversocket with fullpermissions. But still I got this issue and is working fine with JRE 7 or before. – Rajendar Reddy Oct 22 '14 at 14:44
  • have you checked on the server/client that you are trying to communicate with that they are allowing this to connect? – Azureus Nation Oct 23 '14 at 08:06
  • I test with a java client program, this works fine, only with Applet we have issue. may be Applet security need to use full permissions we try with MANIFEST.MF with Permissions: all-permissions and also object parameters for applet. – Rajendar Reddy Oct 24 '14 at 06:55