The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

reply

Posted by Pavan Kumar Keely on June 27, 2001 at 6:38 AM

> I'm having some security issues with an applet I'm writing.

> The applet I'm writing is a little 'uploader' class - all it does is upload a file to a given ftp server. I've gotten it working in an unsecured mode (i.e., by setting grant all permissions in the java.policy file), and I've been trying to get it to work as part of a signed jar file in netscape - I've signed the .jar file with a valid developer id from verisign - which appears to work because I can browse the local filesystem (whereas with an unsigned jar, I get a security exception, unless grant all permissions is set in java.policy). So I'm pretty sure the signing is in place and working. I also see the 'grant permissions' window pop up, and select the apropriate option.

> When I actually start to make the ftp connection, using 'Socket sock = new Socket(String hostname, port)' or 'Socket sock = new Socket(InetAddress host, port)' I get a java.security.AccessControlException - the first part of the error is listed below -

> java.security.AccessControlException: access denied
> (java.net.SocketPermission xxxxx.xxxxx.com resolve)
> at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:272
> )
> (etc...)

> I get a nearly identical message if I specify the IP address as an InetAddress instead of using the hostname.

> I've tried the code with Netscape for linux, mozilla for linux, netscape for windows, and sun's appletviewer- they all say basically the same thing...I haven't tried signing the applet for Internet Explorer yet.

> I don't understand why my applet has permission to browse the local filesystem, but not to make a socket connection. Someone suggested the problem could be due to using swing in the applet, but I'm fairly certain I'm not using any swing components - I'm not importing anything from javax.swing, and the applet does the same thing under appletviewer.

> Many thanks,

> -RN

hi,
What are all the permissions you have set?
You might not have set the Socket permissions. Please try that.

Pavan Kumar Keely




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us