Re: [tcljava-user] Using Tcl Blend with NASA WorldWind Java SDK
Brought to you by:
mdejong
|
From: <Dan...@dl...> - 2007-05-25 09:21:07
|
Hi again,
first of all, thank you for your quick reply!
I haven't yet been able to figure out why I'm getting this =
java.lang.ExceptionInInitializerError, but here's what I get when =
running jtclsh with the -verbose:class option.
medina@medina:/opt/tclblend/bin> ./jtclsh
% set tclblend_init -verbose:class
-verbose:class
% package require java
[...]
1.4.0
% java::new gov.nasa.worldwind.awt.WorldWindowGLCanvas
[...]
[Loaded javax.media.opengl.GLEventListener from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.AVList from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WWObject from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.AVListImpl from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WWObjectImpl from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WorldWindowImpl from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WorldWindowGLAutoDrawable from =
tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.SceneController from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WorldWind from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.RetrievalService from =
tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.ThreadedTaskService from =
tcl.lang.TclClassLoader]
[Loaded java.lang.ExceptionInInitializerError from =
/usr/lib/jvm/java-1.5.0-sun-1.5.0_06/jre/lib/rt.jar]
[Loaded tcl.lang.ReflectObject from =
file:/opt/tclblend/lib/tcljava1.4.0/tcljava.jar]
[Loaded tcl.lang.ArrayObject from =
file:/opt/tclblend/lib/tcljava1.4.0/tcljava.jar]
[Loaded tcl.lang.JavaInfoCmd from =
file:/opt/tclblend/lib/tcljava1.4.0/tcljava.jar]
[Loaded java.beans.IntrospectionException from =
/usr/lib/jvm/java-1.5.0-sun-1.5.0_06/jre/lib/rt.jar]
java.lang.ExceptionInInitializerError
%
There seems to be something wrong with the =
gov.nasa.worldwind.ThreadedTaskService class, right? Or is it when =
trying to load the next class that the error occurs? In this case, how =
can I find out which class it's trying to load after it has successfully =
loaded the ThreadedTaskService class?
Also, running jtclsh with the -verbose:jni option yields this result:
medina@medina:/opt/tclblend/bin> ./jtclsh
% set tclblend_init -verbose:jni
-verbose:jni
% package require java
[...]
1.4.0
% java::new gov.nasa.worldwind.awt.WorldWindowGLCanvas
[...]
[Dynamic-linking native method =
sun.reflect.NativeMethodAccessorImpl.invoke0 ... JNI]
[Dynamic-linking native method =
com.sun.opengl.impl.x11.GLX.glXChooseVisual1 ... JNI]
[Dynamic-linking native method =
com.sun.opengl.impl.x11.GLX.XGetVisualInfo1 ... JNI]
[Dynamic-linking native method com.sun.opengl.impl.x11.GLX.glXGetConfig1 =
... JNI]
[Dynamic-linking native method sun.awt.X11GraphicsDevice.getNumConfigs =
... JNI] //here it stays for a while, before continuing
[Dynamic-linking native method tcl.lang.CObject.newCObject ... JNI]
[Dynamic-linking native method tcl.lang.CObject.incrRefCount ... JNI]
[Dynamic-linking native method tcl.lang.TclList.append ... JNI]
[Dynamic-linking native method tcl.lang.Interp.setErrorCode ... JNI]
[Dynamic-linking native method tcl.lang.CObject.decrRefCount ... JNI]
[Dynamic-linking native method tcl.lang.Interp.setResult ... JNI]
java.lang.ExceptionInInitializerError
%
I also tried to create an instance of another class, =
gov.nasa.worldwind.awt.WorldWindowGLJPanel, and got a similar result:
With -verbose:class option:
medina@medina:/opt/tclblend/bin> ./jtclsh
% set tclblend_init -verbose:class
-verbose:class
% package require java
[...]
1.4.0
% java::new gov.nasa.worldwind.awt.WorldWindowGLJPanel
[...]
[Loaded gov.nasa.worldwind.AVListImpl from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WWObjectImpl from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WorldWindowImpl from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WorldWindowGLAutoDrawable from =
tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.SceneController from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.WorldWind from tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.RetrievalService from =
tcl.lang.TclClassLoader]
[Loaded gov.nasa.worldwind.ThreadedTaskService from =
tcl.lang.TclClassLoader]
[Loaded java.lang.ExceptionInInitializerError from =
/usr/lib/jvm/java-1.5.0-sun-1.5.0_06/jre/lib/rt.jar]
[Loaded tcl.lang.ReflectObject from =
file:/opt/tclblend/lib/tcljava1.4.0/tcljava.jar]
[Loaded tcl.lang.ArrayObject from =
file:/opt/tclblend/lib/tcljava1.4.0/tcljava.jar]
[Loaded tcl.lang.JavaInfoCmd from =
file:/opt/tclblend/lib/tcljava1.4.0/tcljava.jar]
[Loaded java.beans.IntrospectionException from =
/usr/lib/jvm/java-1.5.0-sun-1.5.0_06/jre/lib/rt.jar]
java.lang.ExceptionInInitializerError
%
With -verbose:jni option:
medina@medina:/opt/tclblend/bin> ./jtclsh
% set tclblend_init -verbose:jni
-verbose:jni
% package require java
[...]
1.4.0
% java::new gov.nasa.worldwind.awt.WorldWindowGLJPanel
[...]
[Dynamic-linking native method java.lang.StrictMath.floor ... JNI]
[Dynamic-linking native method java.awt.KeyboardFocusManager.initIDs ... =
JNI]
[Dynamic-linking native method sun.awt.X11.XlibWrapper.XEventsQueued ... =
JNI]
[Dynamic-linking native method sun.awt.X11.XToolkit.waitForEvents ... =
JNI]
[Dynamic-linking native method java.lang.Class.isInstance ... JNI]
[Dynamic-linking native method =
sun.reflect.NativeMethodAccessorImpl.invoke0 ... JNI]
[Dynamic-linking native method java.awt.Rectangle.initIDs ... JNI] =
//here it stays for a while, before continuing
[Dynamic-linking native method tcl.lang.CObject.newCObject ... JNI]
[Dynamic-linking native method tcl.lang.CObject.incrRefCount ... JNI]
[Dynamic-linking native method tcl.lang.TclList.append ... JNI]
[Dynamic-linking native method tcl.lang.Interp.setErrorCode ... JNI]
[Dynamic-linking native method tcl.lang.CObject.decrRefCount ... JNI]
[Dynamic-linking native method tcl.lang.Interp.setResult ... JNI]
java.lang.ExceptionInInitializerError
%=20
Just in case, the contents of the ThreadedTaskService.java file are as =
follows:
---------------------------------------
---------------------------------------
---------------------------------------
/*
Copyright (C) 2001, 2006 United States Government
as represented by the Administrator of the
National Aeronautics and Space Administration.
All Rights Reserved.
*/
package gov.nasa.worldwind;
/**
* @author Tom Gaskins
* @version $Id: ThreadedTaskService.java 1792 2007-05-08 21:28:37Z =
tgaskins $
*/
public class ThreadedTaskService extends WWObjectImpl // TODO: Extract =
interface
implements Thread.UncaughtExceptionHandler
{
static final private int DEFAULT_CORE_POOL_SIZE =3D 1;
static final private int DEFAULT_QUEUE_SIZE =3D 10;
private static final String RUNNING_THREAD_NAME_PREFIX =3D =
WorldWind.retrieveMessage(
"ThreadedTaskService.RUNNING_THREAD_NAME_PREFIX", =
"ThreadStrings");
private static final String IDLE_THREAD_NAME_PREFIX =3D =
WorldWind.retrieveMessage(
"ThreadedTaskService.IDLE_THREAD_NAME_PREFIX", "ThreadStrings");
private java.util.concurrent.ConcurrentLinkedQueue<Runnable> =
activeTasks; // tasks currently allocated a thread
private TaskExecutor executor; // thread pool for running retrievers
public ThreadedTaskService()
{
Integer poolSize =3D =
Configuration.getIntegerValue(AVKey.THREADED_TASK_POOL_SIZE, =
DEFAULT_CORE_POOL_SIZE);
Integer queueSize =3D =
Configuration.getIntegerValue(AVKey.THREADED_TASK_QUEUE_SIZE, =
DEFAULT_QUEUE_SIZE);
// this.executor runs the tasks, each in their own thread
this.executor =3D new TaskExecutor(poolSize, queueSize);
// this.activeTasks holds the list of currently executing tasks
this.activeTasks =3D new =
java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
}
public void uncaughtException(Thread thread, Throwable throwable)
{
if (throwable instanceof WWDuplicateRequestException)
return;
String message =3D =
WorldWind.retrieveErrMsg("ThreadedTaskService.UncaughtExceptionDuringTask=
") + thread.getName();
WorldWind.logger().log(java.util.logging.Level.FINE, message);
=
Thread.currentThread().getThreadGroup().uncaughtException(thread, =
throwable);
}
private class TaskExecutor extends =
java.util.concurrent.ThreadPoolExecutor
{
private static final long THREAD_TIMEOUT =3D 2; // keep idle =
threads alive this many seconds
private TaskExecutor(int poolSize, int queueSize)
{
super(poolSize, poolSize, THREAD_TIMEOUT, =
java.util.concurrent.TimeUnit.SECONDS,
new =
java.util.concurrent.ArrayBlockingQueue<Runnable>(queueSize),
new java.util.concurrent.ThreadFactory()
{
public Thread newThread(Runnable runnable)
{
Thread thread =3D new Thread(runnable);
thread.setDaemon(true);
thread.setPriority(Thread.MIN_PRIORITY);
=
thread.setUncaughtExceptionHandler(ThreadedTaskService.this);
return thread;
}
}, new =
java.util.concurrent.ThreadPoolExecutor.DiscardPolicy() // abandon task =
when queue is full
{
public void rejectedExecution(Runnable runnable,
java.util.concurrent.ThreadPoolExecutor =
threadPoolExecutor)
{
// Interposes logging for rejected execution
String message =3D =
WorldWind.retrieveErrMsg("ThreadedTaskService.ResourceRejected") + =
runnable;
=
WorldWind.logger().log(java.util.logging.Level.FINEST, message);
super.rejectedExecution(runnable, =
threadPoolExecutor);
}
});
}
protected void beforeExecute(Thread thread, Runnable runnable)
{
WorldWind.logger().log(java.util.logging.Level.FINEST, =
WorldWind.retrieveErrMsg(
"ThreadedTaskService.EnteringBeforeExecute"));
if (thread =3D=3D null)
{
String msg =3D =
WorldWind.retrieveErrMsg("nullValue.ThreadIsNull");
WorldWind.logger().log(java.util.logging.Level.FINE, =
msg);
throw new IllegalArgumentException(msg);
}
if (runnable =3D=3D null)
{
String msg =3D =
WorldWind.retrieveErrMsg("nullValue.RunnableIsNull");
WorldWind.logger().log(java.util.logging.Level.FINE, =
msg);
throw new IllegalArgumentException(msg);
}
if (ThreadedTaskService.this.activeTasks.contains(runnable))
{
String message =3D =
WorldWind.retrieveErrMsg("ThreadedTaskService.CancellingDuplicateTask") =
+ runnable;
WorldWind.logger().log(java.util.logging.Level.FINER, =
message);
throw new WWDuplicateRequestException(message);
}
ThreadedTaskService.this.activeTasks.add(runnable);
if (RUNNING_THREAD_NAME_PREFIX !=3D null)
thread.setName(RUNNING_THREAD_NAME_PREFIX + runnable);
thread.setPriority(Thread.MIN_PRIORITY);
=
thread.setUncaughtExceptionHandler(ThreadedTaskService.this);
super.beforeExecute(thread, runnable);
WorldWind.logger().log(java.util.logging.Level.FINEST, =
WorldWind.retrieveErrMsg(
"ThreadedTaskService.LeavingBeforeExecute"));
}
protected void afterExecute(Runnable runnable, Throwable =
throwable)
{
WorldWind.logger().log(java.util.logging.Level.FINEST, =
WorldWind.retrieveErrMsg(
"ThreadedTaskService.EnteringAfterExecute"));
if (runnable =3D=3D null)
{
String msg =3D =
WorldWind.retrieveErrMsg("nullValue.RunnableIsNull");
WorldWind.logger().log(java.util.logging.Level.FINE, =
msg);
throw new IllegalArgumentException(msg);
}
super.afterExecute(runnable, throwable);
ThreadedTaskService.this.activeTasks.remove(runnable);
if (throwable =3D=3D null && IDLE_THREAD_NAME_PREFIX !=3D =
null)
Thread.currentThread().setName(IDLE_THREAD_NAME_PREFIX);
}
}
public synchronized boolean contains(Runnable runnable)
{
//noinspection SimplifiableIfStatement
if (runnable =3D=3D null)
return false;
return (this.activeTasks.contains(runnable) || =
this.executor.getQueue().contains(runnable));
}
/**
* Enqueues a task to run.
* @param runnable the task to add
* @throws IllegalArgumentException if <code>runnable</code> is null
*/
public synchronized void addTask(Runnable runnable)
{
if (runnable =3D=3D null)
{
String message =3D =
WorldWind.retrieveErrMsg("nullValue.RunnableIsNull");
WorldWind.logger().log(java.util.logging.Level.FINE, =
message);
throw new IllegalArgumentException(message);
}
// Do not queue duplicates.
if (this.activeTasks.contains(runnable) || =
this.executor.getQueue().contains(runnable))
return;
this.executor.execute(runnable);
}
public boolean isFull()
{
return this.executor.getQueue().remainingCapacity() =3D=3D 0;
}
}
---------------------------------------
---------------------------------------
---------------------------------------
I really would be very grateful if you could help me with this.
Kind regards,
Daniel Medina
-----Original Message-----
From: tcl...@li... on behalf of Mo DeJong
Sent: Wed 5/23/2007 9:46 PM
To: A list for users of tcljava
Subject: Re: [tcljava-user] Using Tcl Blend with NASA WorldWind Java SDK
=20
Dan...@dl... wrote:
> Hi,
> =20
> Specifically, I get the following error message when trying to create =
a WorldWindowGLCanvas object from jtclsh:
> =20
> medina@onyx:/opt/tclblend/bin> ./jtclsh
> % package require java
> 1.4.0
> % java::call System getProperty "java.version"
> 1.5.0_06
> =20
Tcl Blend should work find with JDK 1.5.
> % java::new javax.swing.JFrame
> java0x1
> % java::new javax.media.opengl.GLCanvas
> java0x2
> % java::new gov.nasa.worldwind.layers.IconLayer
> java0x3
> % java::new gov.nasa.worldwind.layers.Earth.EarthNASAPlaceNameLayer
> java0x4
> % java::new gov.nasa.worldwind.awt.AWTInputHandler
> java0x5
> % java::new gov.nasa.worldwind.awt.WorldWindowGLCanvas
> java.lang.ExceptionInInitializerError
> =20
This is a generic Java error that indicates an exception was raised=20
while loading the class or invoking the
static init method for the class. You will have to look at the class in=20
question to find out why. If this package
uses native code then it could fail because it does not find needed DLL=20
on the PATH.
I hope that helps
Mo
-------------------------------------------------------------------------=
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
tcljava-user mailing list
tcl...@li...
https://lists.sourceforge.net/lists/listinfo/tcljava-user
|