Permissions and threads

Greetings all,
I have a small visad application which I am running as an applet, either
from Netscape with the Java plug-in or using the AppletViewer. The
applet sits on a web server with visad.jar. When run, it communicates
via RMI to a server program running on another machine (which in turn
talks to some weather databases via JDBC).
The applet uses DisplayImplJ3D to show a map of weather stations, with
their period of operation in the z-axis.
I've included the code below in case it is relevant.
The thing basically works, but with one annoying aspect. I have to grant
the codebase http:...visad.jar AllPermission to avoid getting the
following message when I rotate the 3D display:
Exception occurred during Behavior execution:
java.lang.SecurityException: Access denied to ThreadGroup not owned by
applet
at
sun.applet.AppletSecurity.getThreadGroup(AppletSecurity.java:241)
at java.lang.Thread.init(Thread.java:251)
at java.lang.Thread.<init>(Thread.java:325)
at visad.util.ThreadPool$ThreadMinnow.<init>(ThreadPool.java:63)
at visad.util.ThreadPool.queue(ThreadPool.java:166)
at visad.ActionImpl.notifyAction(ActionImpl.java:263)
at visad.DisplayImpl.controlChanged(DisplayImpl.java:682)
at visad.Control.incTick(Control.java:98)
at visad.Control.changeControl(Compiled Code)
at
visad.java3d.ProjectionControlJ3D.setMatrix(ProjectionControlJ3D.java
:82)
at visad.MouseHelper.processEvent(MouseHelper.java:371)
at visad.java3d.MouseBehaviorJ3D.processStimulus(Compiled Code)
at javax.media.j3d.BehaviorScheduler.processBehaviors(Compiled
Code)
at javax.media.j3d.BehaviorScheduler.run(Compiled Code)
I don't like granting codeBases AllPermission, but if I try granting all
the other permissions I still seem to get the exception. Can anybody
help?
Here is the visad code:
RealTupleType stationSpan
new RealTupleType(RealType.Latitude,
RealType.Longitude,RealType.Time);
int nstations=testquery.stations.size();
System.out.println("Number of stations to plot "+nstations);
float span[][]=new float[3][2];
Gridded3DSet[] accum = new Gridded3DSet[nstations];
for (int i=0;i<nstations;i++){
ClientStation current=(ClientStation)
testquery.stations.elementAt(i);
java.util.Date dummytime=current.operational.getEnd();
if (dummytime==null)
dummytime=localCalendar.getTime();
span[0][0]=(float) current.latitude;
span[1][0]=(float) current.longitude;
span[2][0]=(float) current.operational.getStart().getTime();
span[0][1]=(float) current.latitude;
span[1][1]=(float) current.longitude;
span[2][1]=(float) dummytime.getTime();
accum[i] = new Gridded3DSet(stationSpan,span,2);
}
UnionSet happyUnion = new UnionSet(stationSpan,accum);
final DataReference stations_ref = new
DataReferenceImpl("stations");
stations_ref.setData(happyUnion);
// create a Display using Java3D
DisplayImpl display = new DisplayImplJ3D("image display");
// map earth coordinates to display coordinates
display.addMap(new ScalarMap(RealType.Latitude, Display.YAxis));
display.addMap(new ScalarMap(RealType.Longitude,
Display.XAxis));
display.addMap(new ScalarMap(RealType.Time, Display.ZAxis));
GraphicsModeControl mode=display.getGraphicsModeControl();
mode.setScaleEnable(true);
// link the Display to rivers_ref
display.addReference(stations_ref);
try {
BaseMapAdapter baseMap = new BaseMapAdapter(new
URL("http://mayumi.narc.affrc.go.jp/~matthewl/visadapplet/OUTLSUPW&quot;));
baseMap.setLatLonLimits(latMin,latMax,longMin,longMax);
Data mapData = baseMap.getData();
DataReference mapRef = new DataReferenceImpl("mapData");
mapRef.setData(mapData);
ConstantMap[] rendMap;
rendMap = new ConstantMap[1];
rendMap[0] = new ConstantMap(-.99, Display.ZAxis);
display.addReference(mapRef, rendMap);
} catch (Exception mapop) {
mapop.printStackTrace();
}
// create JPanel in JFrame
panel3D.setLayout(new BoxLayout(panel3D, BoxLayout.Y_AXIS));
panel3D.setAlignmentY(JPanel.TOP_ALIGNMENT);
panel3D.setAlignmentX(JPanel.LEFT_ALIGNMENT);
// add display to JPanel
panel3D.add(display.getComponent());
--
Matthew Laurenson
National Agriculture Research Center
Ministry of Agriculture, Forestry and Fisheries
3-1-1 Kannondai
Tsukuba
Ibaraki 305-8666
JAPAN
ph +81-298-38-7025
fax +81-298-38-8551