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

RE: how can I open netcdf file in applet?



Dear Monica,

 

I think signing the applet isn’t enough – you need to change the security settings too.

 

This isn’t really a netCDF question.  It’s a more general question about how to load data into Java applets from remote servers.  You will get more helpful responses from mailing lists or websites concerned with Java applet development.  This question must have been asked lots of times before.

 

Good luck,

Jon

 


From: address@hidden [mailto:address@hidden] On Behalf Of ???
Sent: 14 February 2006 02:33
To: address@hidden
Subject: Re: how can I open netcdf file in applet?

 

Dear All:
  Before I try to open remote netcdf file in unsign applet fail.
  Now I decide to sign my applet, but still get new error message in Java console :
 
  //I want use Applet and NetCDF Java Library (Version 2.2.13)
  //to open the remote netcdf file(
http://61.60.103.48:81/g2var1level.nc)
  //and print the Variable("lon" & "lat")size and data.
 
  Java Plug-in 1.5.0_06
  JRE version 1.5.0_06 Java HotSpot(TM) Client VM
  Exception in thread "Timeout guard" java.security.AccessControlException: access denied

  (java.net.SocketPermission 61.60.103.48:81 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 java.net.Socket.connect(Unknown Source)
  at java.net.Socket.connect(Unknown Source)
  at java.net.Socket.<init>(Unknown Source)
  at java.net.Socket.<init>(Unknown Source)
  at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
  at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java:90)
  at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run   

  (ControllerThreadSocketFactory.java:157)
  at java.lang.Thread.run(Unknown Source)
  java.lang.NullPointerException
  at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:720)
  at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
  at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
  at ucar.unidata.io.http.HTTPRandomAccessFile3.doConnect(HTTPRandomAccessFile3.java:102)
  at ucar.unidata.io.http.HTTPRandomAccessFile3.<init>(HTTPRandomAccessFile3.java:70)
  at ucar.unidata.io.http.HTTPRandomAccessFile3.<init>(HTTPRandomAccessFile3.java:53)
  at ucar.nc2.NetcdfFile.open(NetcdfFile.java:207)
  at ucar.nc2.NetcdfFile.open(NetcdfFile.java:167)
  at ucar.nc2.NetcdfFile.open(NetcdfFile.java:151)
  at MyNetcdfApplet.init(MyNetcdfApplet.java:32)
  at sun.applet.AppletPanel.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
 
  These Steps I try to sign my applet :
  1.Generate keys
        keytool -genkey - keyalg rsa -alias keyname
        keytool -export -alias keyname -file anyname.crt


  2.create Jar file
        jar cmf manifest MyNetcdfApplet.jar MyNetcdfApplet.class nc2.2.jar
    
   manifest content :
       Manifest-Version: 1.0
       Created-By: 1.4.2_04 (Sun Microsystems Inc.)
       Class-Path: nc2.2.jar
       Main-Class: MyNetcdfApplet
  
  3.sign MyNetcdfApplet
       jarsigner MyNetcdfApplet.jar keyname
 
  4. use htmlconverter command to MyNetcdfApplet.html
    
  I use the function in Applet to open the remote file,
  (the function can run in application): 
  
   MyNetcdfApplet.java code :
   String urlfile = getParameter("NCFile"); //The netcdf file also be in My applet class folder.
   NetcdfFile ncfile = NetcdfFile.open(urlfile);
 
   MyNetcdfApplet.html code :
   <applet code="MyNetcdfApplet.class" archive="MyNetcdfApplet.jar" codebase=. width=300 height=400>
   ...
   </applet> 

 

   I still can't run MyNetcdfApplet.html in my computer.
   May I miss some import step ?
   Could someone tell me what wrong that I did
   or give me some example about applet open remote netcdf file? thanks a lot..
  
   Thanks many people help me ~
 
                                                                                                                    Monica