Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Signed Applet cannot connect to different host

843807Oct 21 2008 — edited Oct 30 2008
All,

I am trying to do some pretty "heavy lifting" for an applet (like downloading, installing, and running JNI code). I have gotten all of that to work. Yay. What I am running into are some unexpected issues when trying to open a socket connection to a host OTHER than the machine that served the SIGNED applet JAR.

I am running on Windows Vista Business 64 bit. Java Plugin version 1.6.0 Update 10. What I am seeing is:
java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.1.181: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 java.lang.SecurityManager.checkConnect(Unknown Source)
	at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
	at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.DeployCacheHandler.get(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	... 6 more
Exception: java.lang.RuntimeException: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.1.181:8080 connect,resolve)
when i try to do something like:
new URL("http://192.168.1.181:8080/interestingfile.xml").openConnection();
I've tried to use the AccessControll.checkPermission to ensure I have the right permissions, but they all pass successfully:
AccessController.checkPermission(new AllPermission());
AccessController.checkPermission(new SocketPermission("192.168.1.181:8080", "connect, resolve"));
even though I know the second checkPermission should fail with an Exception.

I am access the applet via a URL of 127.0.0.1:8080 (and it fails). I can connect to the applet via a URL 192.168.1.181:8080 (and it works).

I am running all of this on Windows Vista Business 64bit. I have read a lot of things talking about how the security manager is more rigid on Vista than on other windows platforms. Are there any documents out there that is more specific? Am I doing something stupid? If it's a SIGNED applet, I want it to have the permissions expected!

Appreciate your help.

cheers,
Eric

Edited by: webmonatch on Oct 21, 2008 4:08 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 27 2008
Added on Oct 21 2008
3 comments
644 views