java socket permission problem

2019-08-15 14:58发布

问题:

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