Bernd Kreimeier <[EMAIL PROTECTED]> writes:
> > JNI problems
>
> My infamous inload test (see http://www.netaccess.ie/~bk/jdkjni/)
Shouldn't that be http://www.netaccess.ie/~bk/jdk/ ?
> fails as usual, but more verbose than ever. I do not get a thread
> dump this time.
>
> >inload
> loading DLL libjava.so
> loaded DLL
> getting DLL address of JNI_GetDefaultJavaVMInitArgs
> address 1074782176 in DLL
> getting DLL address of JNI_CreateJavaVM
> address 1074782560 in DLL
> Classpath default:
>/../../../classes:/../../classes.zip:/../../classes.jar:/../../rt.jar:/../../i18n.jar
> Classpath added:
>/../../../classes:/../../classes.zip:/../../classes.jar:/../../rt.jar:/../../i18n.jar:/opt/local/java/jdk/lib/classes.zip:.
> Creating VM...
> Tried to free bogus memory 804a308, ignored
> Tried to free bogus memory 804a328, ignored
> Tried to free bogus memory 8071008, ignored
> Tried to free bogus memory 804a530, ignored
> Tried to free bogus memory 809b048, ignored
> Tried to free bogus memory 809b090, ignored
> .. ad nauseam
> Tried to free bogus memory 82ce278, ignored
> SIGSEGV 11* segmentation violation
> stackbase=(nil), stackpointer=(nil)
>
> Full thread dump:
> NULL (TID:0x405000b0, sys_thread_t:0x807d260, state:R) prio=5Killed
>
>
> Note the Classpath. If I do not add the classes.zip path, I get:
Yes, you have to tell the VM where it can find classes.zip.
>
> Creating VM...
> Tried to free bogus memory 804a2b8, ignored
> Tried to free bogus memory 804a2d8, ignored
> Unable to initialize threads: cannot find class java/lang/Thread
> Can't create Java VM
>
> This is RH 5.1, glibc-2.0.7-13, JDK 1.1.6v2-glibc, both gcc and
> egcs as with the install.
>
> Another remark: the classpath append I do in the inload.c
> source failed JDK 1.1.5 and 1.1.6 on Solaris. The entire test
> of libdl/libjava cooperation failed with all JDK's I got to
> run, under Debian 1.3.1, RH 5.0, RH 5.1, and Solaris, with
> thread dumps or (Solaris) bogus classpath problems.
>
> The equivalent Win32 source (DLL loading has a different API)
> works. The program also works with Japhar-0.04.
>
> I would greatly appreciate if you could drop by and check
> the small test program on your install, esp. if you are
> running gcc-2.8.1 or a egcs install more recent than:
> egcs-2.90.27 980315 (egcs-1.0.2 release).
You know that that the JNI Invocation API is documented not to work
with green threads?
The green threads' libjava.so overrides some system calls, so the
first thing in a green threads program must be creating the vm otherwise
system calls like open() will not work properly.
You should go to a solaris machine and test your code with native threads.
(I find some time I will try with Solaris 2.6 and JDK-1.1.6 native threads).
We really need a native threads vm for linux.
Juergen.
--
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802