🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java
Article #366

Re: AccessControlException : Access Denied

#366
From: Bill Hamlin
Date: Thu, 10 Aug 2000 00:00
112 lines
5755 bytes
I have a related question.  I have an applet that uses the java.net.Socket
class.  It runs OK in Netscape but for it to run in IE I need to set the
security level to "Low".  I'm opening a socket to a port on the same machine
from which I load the web page/applet.

Is there a way for me to get this to run in the "Medium" level (I'm running
IE 5.0 by the way).




Daniel J. Woods <dwoods@gssec.bt.co.uk> wrote in message
news:39928C32.EDAD2338@gssec.bt.co.uk...
> Applets can't use file I/O on the host machine unless they've been
> expressly given permission to do so using digital signatures (a lengthy
> process I'm none too keen on). The rationale behind this comes from the
> fact that applets are essentially untrusted code which is downloaded
> from some remote source and run on your browser--not something you want
> to be snooping around your hard-drive (potentially deleting whatever it
> wants).
>
> Aside from the digital signatures thingy, applets can only load files
> from the server from which it was downloaded. This involves establishing
> a connection to the server a la:
> ...
> URL myFile;
> InputStream fileStream;
>
> try {
>   myFile = new URL(getCodeBase(),"somefile.whatever");
> } catch(MalformedURLException murle) {
>   // exception handling stuff
> }
>
> try {
>   fileStream = myFile.openStream();
>   // other stuff like reading
> } catch(IOException ioe) {
>   // more exception handling stuff
> }
>
> etc.
>
> The important thing to remember is that the applet was (presumably)
> downloaded from some Web-server somewhere, and that it doesn't have
> access to the user's PC at all--only resources on the server are
> available.
>
> Hope that's useful,
>
> Danny.
>
> P.Goovaerts@Clipper.Be wrote:
>
> >
> > We are new in the Java world and agree that this is a very powerfull
> > language but ...  how the ... do you learn it ?  We are stuck under
> > lots of books, url's, newsgroups,... where is the time you bought an
> > RPG / COBOL book and started to program ...
> >
> > OK, after a couple of weeks we are able to create little 'stand alone'
> > Java programs wich runs fine on our PC.  The application(s) retrieves
> > records from the AS400 using DPC and displays them on screen.  Then we
> > changed them into an applet by adding (extends JAPPLET) and replacing
> > the main() method by init() method.  All neccessary classes and images
> > are stored on AS400Webfolder.  (We didn't pack them in a Jar file).
> >
> > Compile give no error but when calling URL in browser, following
> > happens :
> > - jt400.jar file loads (archive=jt400.jar in htmldoc)
> > - message is shown that Class xxxx is not found.
> >
> > Then I call same applet with appletviewer and following occurs :
> >
> > - AccessControlException occurs with following details:
> >
> > C:\WINDOWS>appletviewer http://s44a5189:2021/BH_HTTP/Conti.html
> > java.security.AccessControlException: access denied
> > (java.io.FilePermission butt
> > o61c.gif read)
> >        at
> > java.security.AccessControlContext.checkPermission(AccessControlConte
> > xt.java:195)
> >        at
> > java.security.AccessController.checkPermission(AccessController.java,
> > Compiled Code)
> >        at
> > java.lang.SecurityManager.checkPermission(SecurityManager.java, Compi
> > led Code)
> >        at
> > java.lang.SecurityManager.checkRead(SecurityManager.java:873)
> >        at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:242)
> >        at sun.awt.SunToolkit.getImage(SunToolkit.java:256)
> >        at javax.swing.ImageIcon.<init>(ImageIcon.java:64)
> >        at javax.swing.ImageIcon.<init>(ImageIcon.java:83)
> >        at Conti.<init>(Conti.java:54)
> >        at java.lang.Class.newInstance0(Native Method)
> >        at java.lang.Class.newInstance(Class.java:241)
> >        at sun.applet.AppletPanel.createApplet(AppletPanel.java:517)
> >        at sun.applet.AppletPanel.runLoader(AppletPanel.java:453)
> >        at sun.applet.AppletPanel.run(AppletPanel.java:291)
> >        at java.lang.Thread.run(Thread.java:479)
>
> --
> Danny Woods
> Software Engineer
> BT CDMC Data Quality
> -- Unless otherwise stated, what's in this mail is purely my opinion,
> -- not that of BT.
>
>
>
Technical Details
Message-ID: <Y1yk5.35977$sO2.129209@typhoon.tampabay.rr.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <f_sk5.13$gG5.927@nreader1.kpnqwest.net> <39928C32.EDAD2338@gssec.bt.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6e60,b304918546c7951d
X-Google-Attributes: gidf6e60,public
X-Google-Thread: 10d861,b304918546c7951d
X-Google-Attributes: gid10d861,public
X-Google-Thread: f5d71,b304918546c7951d
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 10d6db,b304918546c7951d
X-Google-Attributes: gid10d6db,public
X-Google-Thread: 113ae9,b304918546c7951d
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 10fd6d,b304918546c7951d
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: fecd1,b304918546c7951d
X-Google-Attributes: gidfecd1,public
X-Google-Thread: 107d55,b304918546c7951d
X-Google-Attributes: gid107d55,public
From: "Bill Hamlin" <bhamlin@telephoneswitch.com>
Subject: Re: AccessControlException : Access Denied
Date: 2000/08/10
Message-ID: <Y1yk5.35977$sO2.129209@typhoon.tampabay.rr.com>
X-Deja-AN: 656747550
References: <f_sk5.13$gG5.927@nreader1.kpnqwest.net> <39928C32.EDAD2338@gssec.bt.co.uk>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: abuse@rr.com
X-Trace: typhoon.tampabay.rr.com 965913848 24.92.221.107 (Thu, 10 Aug 2000 09:24:08 EDT)
Organization: RoadRunner - TampaBay
X-MSMail-Priority: Normal
NNTP-Posting-Date: Thu, 10 Aug 2000 09:24:08 EDT
Newsgroups: comp.lang.java,comp.lang.java.api,comp.lang.java.gui,comp.lang.java.help,comp.lang.java.tech,algonet.www.java,alt.www.hotjava,aus.computers.java