获取异常 java.net.SocketPermission

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19173590/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:44:34  来源:igfitidea点击:

Getting exception java.net.SocketPermission

java

提问by user2826111

I have jApplet where I want to send buffer to server and dump on it, but why AccessControlException I am not able to understand.

我有 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)

采纳答案by Tej Kiran

According to the exception, Your application does not have rights to access the socket 8080.

根据例外情况,您的应用程序无权访问套接字 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";
};

Ref : https://forums.oracle.com/thread/1178887it may help you

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

See it too : Java RMI AccessControlException: access denied

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