获得异常java.net.SocketPermission

时间:2013-10-04 05:02:29

标签: java

我有jApplet,我想将缓冲区发送到服务器并转储到它,但为什么AccessControlException我无法理解。

 java.security.AccessControlException: access denied (java.net.SocketPermission endpoint:8080 connect,resolve)
            at java.security.AccessControlContext.checkPermission(Unknown Source)
            at java.security.AccessController.checkPermission(Unknown Source)
            at java.lang.SecurityManager.checkPermission(Unknown Source)
            at sun.awt.AWTSecurityManager.checkPermission(AWTSecurityManager.java:959)
            at java.lang.SecurityManager.checkConnect(Unknown Source)
            at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)

1 个答案:

答案 0 :(得分:2)

根据例外情况,您的应用程序无权访问套接字8080。

grant{
    permission java.net.SocketPermission "localhost:1099", "connect, resolve";
    permission java.net.SocketPermission "localhost:1024-", "connect, resolve";
    permission java.net.SocketPermission "localhost:1024-", "accept, resolve";
};

参考:https://forums.oracle.com/thread/1178887它可以帮到你

也可以看到它:Java RMI AccessControlException: access denied