[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java.security.AccessControlException opening from an applet

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Re: java.security.AccessControlException opening from an applet
  • Date: Mon, 24 Apr 2006 12:15:37 -0500

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 <address@hidden> 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 address@hidden


--
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
===============================================================================