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

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
Title: VisAD SocketServer Applet

Here is an example applet that uses VisAD. To view it, you need to have the Java Plug-in installed, along with the Java 2 Runtime Environment and Java3D v1.2.1 or later.

Attachment: MyNetcdfApplet.java
Description: Binary data