Re: java.security.AccessControlException opening from an applet

It would be useful to see the complete stack trace. It looks like you are 
trying to read a local file?? As Tom said, applets dont have that right.

Tom Whittaker wrote:
Santi:

In general, applets are not permitted to communicate with a host other
than the one they were loaded from.  In previous JVMs, this rule when
using a local URL was relaxed.  In later versions of Java it is more
strictly enforced (as it always has been for loading applets from
remote hosts).

You might (I havent tried it) be able to use the
AccessController.doPrivileged() method to enable this -- I just don't
know if it would pop-up a user dialog for each I/O though.  Some more
info at:
<http://www.raditha.com/java/sandbox/unsigned.php>

Regards,

tom

On 4/24/06, S Santos <s.santos@xxxxxxxxx> wrote:

Hello,

I'm developing a tool to display netCDF files. The program has two versions,
a desktop one and an applet version. When I load from a URL using the applet
version java throws this exception:

java.security.AccessControlException: access denied
(java.io.FilePermission
http%3A%2F%2Flocalhost%3A8080%2Fsoftiam-portal%2Fusers%2Fe145%2FIPCC_ESM+Magicc_SCM%2Fmagicc_out.nc
read)
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.checkRead(Unknown Source)
at java.io.RandomAccessFile.<init>(Unknown Source)
at java.io.RandomAccessFile.<init>(Unknown Source)
at
ucar.unidata.io.RandomAccessFile.<init>(RandomAccessFile.java:134)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:217)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:167)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:151)
at
softiam.services.ui.dataAnalysis.util.NetCDFReader.<init>(NetCDFReader.java:42)
at
softiam.services.ui.dataAnalysis.engine.SoftiamRepresentation.setNetCDFFile(SoftiamRepresentation.java:130)
at
softiam.services.ui.dataAnalysis.tool.SoftiamAnalyzer.loadURL(SoftiamAnalyzer.java:630)
at
softiam.services.ui.dataAnalysis.tool.SoftiamAnalyzerApplet.init(SoftiamAnalyzerApplet.java:38)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The system uses netCDF 2.2.14 version with slf4j-simple.jar and
log4j-1.2.13.jar for Http connections. In a previous version using netCDF
2.1.10 this problem didn't happen. Is there any solution to this problem
without having to change java security policy files?

Regards,

Santi


Santiago de la Nava Santos
Software Engineer
Tyndall Centre
Zuckermann Institute
University of East Anglia
Norwich NR4 7TJ

Telephone 01603 591377
Fax 01603 593901
E-mail s.santos@xxxxxxxxx



--
Tom Whittaker
University of Wisconsin-Madison
SSEC/CIMSS
1225 W. Dayton Street
Madison, WI  53706  USA
ph: 608-262-2759

==============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: