java socket permission problem

雨燕双飞 提交于 2019-12-24 15:13:49

问题


I have a need to write to a remote machine via a Socket from within an applet. The applet resides within an intranet within a closed hospital system so changing the java security file is not an issue. From the Oracle site, they recommend the following policy change:

grant { permission java.net.SocketPermission "10.130.71.156:8000", "connect,accept"; };

I have done this but I am still getting the following error:

java.security.AccessControlException: access denied (java.net.SocketPermission [10.130.71.156:8000]resolve)     

Any ideas of what the problem could be?


回答1:


The way the question is formulated right now, the SecurityException is thrown since the policy doesn't allow "resolve". The policy should most likely be

grant { permission java.net.SocketPermission "10.130.71.156:8000", "connect,resolve"; };




回答2:


There was a configuration problem that was causing the error. The IP address in the config file did not match the IP address in the policy file. That is why there was the security error. The person (ataylor) who in their comment recommended using the wildcard deserves the credit for answering this one. The wildcard allowed us to see what DNS was being polled. Thank you!

Elliott



来源:https://stackoverflow.com/questions/7326086/java-socket-permission-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!