java socket permission problem

2019-08-15 14:59发布

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?

2条回答
叛逆
2楼-- · 2019-08-15 15:14

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"; };

查看更多
对你真心纯属浪费
3楼-- · 2019-08-15 15:25

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

查看更多
登录 后发表回答