System.getProperties() results in java.security.AccessControlException
843833Jun 2 2005 — edited Jun 2 2005Hi All,
I'm building an web service that needs to make an URL connection.
In order to build the connection, I must set the proxy.
The problem is it seems that I cannot do
Properties Sys=System.getProperties();
since it results in the following exception :
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
here is part of my code (part of the implementation of the SEI of my web service)
Properties Sys=System.getProperties();
Sys.put("proxySet","true");
Sys.put("proxyPort","8080");
Sys.put("proxyHost","webcache.singapore.sun.com");
URL url = new URL("http://www.geobytes.com/IpLocator.htm?GetLocation");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
I'm using SUN App Server 8, my IDE is netbeans 4.1
Any other way in setting the proxy without getting properties from my system? or any work around to make my code working. Please help me, any suggestions are highly appreciated.
Regards,
maggy