List Info

Thread: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM from n




Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM from n
user name
2008-03-29 01:36:11
I'm having trouble using JNI software on FreeBSD.
In summary:
- I'm able to call native routines from a Java VM via JNI
- However in the other direction JNI seems not to work. I
can't create a JVM
via JNI from native software.
Admittedly, I'm using one specific software (R with rJava)
and haven't tried
running my own JNI software.

What I'm noticing is that a call to JNI_CreateJavaVM () in
/usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so results in
SIGSYS, Bad
Sytem Call.

Here's my output from running R with rJava under gdb with a
stack backtrace.
It all seems to go pear-shaped at JNI_CreateJavaVM () :


# R -d gdb
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show
warranty" for details.
This GDB was configured as
"i386-marcel-freebsd"...(no debugging symbols
found)...
(gdb) run
Starting program: /usr/local/lib/R/bin/exec/R

R version 2.6.0 (2007-10-03)
Copyright (C) 2007 The R Foundation for Statistical
Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain
conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in
publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(rJava)
[New LWP 100145]
[New Thread 0x28909300 (LWP 100145)]
> .jinit() ######(calls code to invoke the JVM)
[New Thread 0x28909200 (LWP 100169)]
[New Thread 0x28909500 (LWP 100170)]
[New Thread 0x28909600 (LWP 100171)]

Program received signal SIGSYS, Bad system call.
[Switching to Thread 0x28909300 (LWP 100145)]
0x2830a86b in ksem_init () from /lib/libc.so.7
(gdb) bt
#0  0x2830a86b in ksem_init () from /lib/libc.so.7
#1  0x28300229 in sem_init () from /lib/libc.so.7
#2  0x29ab0e59 in os::signal_init_pd ()
   from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#3  0x29aaeb62 in os::signal_init ()
   from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#4  0x29b39342 in Threads::create_vm ()
   from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#5  0x299aa736 in JNI_CreateJavaVM ()
   from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#6  0xbfbfd66b in ?? ()
#7  0x00000000 in ?? ()
#8  0x00000000 in ?? ()
#9  0xbfbfd584 in ?? ()
#10 0x00000009 in ?? ()
#11 0xffffffff in ?? ()
#12 0x299a91cf in JNI_GetDefaultJavaVMInitArgs ()
   from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
Previous frame inner to this frame (corrupt stack?)
(gdb)

I'm running this under a clean install of 7-Release I386:

# uname -a
FreeBSD  7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24
19:59:52 UTC
2008     rootlogan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC 
i386

I was getting the same result on my existing installation,
so in case it was
some mix-up with libraries I tried new installations of
7-Release and also
PCBSD-1.5 (based on 6.3), both with the same result.

I've tried Java 1.6 built from ports (usr/ports/java/jdk16)

# java -version
java version "1.6.0_03-p3"
Java(TM) SE Runtime Environment (build
1.6.0_03-p3-root_16_feb_2008_09_59-b00)
Java HotSpot(TM) Client VM (build
1.6.0_03-p3-root_16_feb_2008_09_59-b00,
mixed mode)


I've also tried Diablo-Java1.5 as follows, with exactly the
same result as
above.

# java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
diablo-1.5.0-b01)
Java HotSpot(TM) Client VM (build diablo-1.5.0_07-b01, mixed
mode)

Both jdk1.5 and jdk1.6 gave exactly the same result.

I'm going to check with the rJava developers to see if they
can assist, but
I thought I'd check on this list if there are any known
special issues to
get JNI working fully under FreeBSD (specifically to create
a JVM and use
Java objects from native software), or if it is known not to
work?

Thanks for any help

Rod.
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

Re: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM fr
user name
2008-03-29 09:53:52
Yeah, it works.  Take a look at jsvc that ships with Tomcat
6.  It binds 
to a port, drops root permission and creates a JVM and does
back and forth 
communication with Tomcat.

   Nick

On Sat, 29 Mar 2008, Rod wrote:

> I'm having trouble using JNI software on FreeBSD.
> In summary:
> - I'm able to call native routines from a Java VM via
JNI
> - However in the other direction JNI seems not to work.
I can't create a JVM
> via JNI from native software.
> Admittedly, I'm using one specific software (R with
rJava) and haven't tried
> running my own JNI software.
> 
> What I'm noticing is that a call to JNI_CreateJavaVM ()
in
> /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
results in SIGSYS, Bad
> Sytem Call.
> 
> Here's my output from running R with rJava under gdb
with a stack backtrace.
> It all seems to go pear-shaped at JNI_CreateJavaVM ()
:
> 

-- 
"Courage isn't just a matter of not being frightened,
you know. It's being
 afraid and doing what you have to do anyway."
   Doctor Who - Planet of the Daleks
This message has been brought to you by Nick Johnson 2.3b1
and the number 6.
http://healerNick.com/ 
     http://morons.org/    
   http://spatula.net/
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

Re: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM fr
country flaguser name
Australia
2008-03-30 01:45:32
Nick

Thanks,

I'm still having trouble trying to invoke the JVM from
FreeBSD.
I compiled and ran the simple C++ JNI invocation program
below, linked against 
jdk1.6.0 on FreeBSD7.0-Release. (Tried linking against
diablo-jdk1.5.0 also - 
same result).

I got the same result as trying to run rJava: Program
received signal SIGSYS 
(Bad system call).



or in gdb:

# gdb ./a.out
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show
warranty" for details.
This GDB was configured as
"i386-marcel-freebsd"...(no debugging symbols 
found)...
(gdb) run
Starting program: /usr/home/test3/src/a.out
(no debugging symbols found)...(no debugging symbols
found)...(no debugging 
symbols found)...(no debugging symbols found)...(no
debugging symbols 
found)...(no debugging symbols found)...[New LWP 100131]
(no debugging symbols found)...[New Thread 0x28b01100 (LWP
100131)]
(no debugging symbols found)...(no debugging symbols
found)...(no debugging 
symbols found)...(no debugging symbols found)...(no
debugging symbols 
found)...[New Thread 0x28b01300 (LWP 100192)]
[New Thread 0x28b01500 (LWP 100193)]
[New Thread 0x28b01600 (LWP 100203)]

Program received signal SIGSYS, Bad system call.
[Switching to Thread 0x28b01100 (LWP 100131)]
0x289bb86b in ksem_init () from /lib/libc.so.7
(gdb) bt
#0  0x289bb86b in ksem_init () from /lib/libc.so.7
#1  0x289b1229 in sem_init () from /lib/libc.so.7
#2  0x28321e59 in os::signal_init_pd () 
from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#3  0x2831fb62 in os::signal_init () 
from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#4  0x283aa342 in Threads::create_vm () 
from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#5  0x2821b736 in JNI_CreateJavaVM () 
from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
#6  0xbfbfe80b in ?? ()
#7  0x00000000 in ?? ()
#8  0x00000000 in ?? ()
#9  0x00000000 in ?? ()
#10 0xbfbfe868 in ?? ()
#11 0xffffffff in ?? ()
#12 0x28077000 in ?? ()
#13 0x00000018 in ?? ()
#14 0x28b0c000 in ?? ()
#15 0x01bfe850 in ?? ()
#16 0x00000001 in ?? ()
#17 0xbfbfe8b0 in ?? ()
#18 0x00000000 in ?? ()
#19 0xbfbfe868 in ?? ()
#20 0x080488ea in main ()
(gdb)   


Invocation program,  built with compiler flags:

-I/usr/local/jdk1.6.0/include
-I/usr/local/jdk1.6.0/include/freebsd
-L/usr/local/jdk1.6.0/jre/lib/i386/server -ljvm

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif



using namespace std;

#include <iostream>
#include <cstdlib>
#include <jni.h>    /* where everything is defined */



int main(int argc, char *argv[])
{

    JavaVM *jvm;       /* denotes a Java VM */
    JNIEnv *env;       /* pointer to native method interface
*/
    JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization
arguments */
    JavaVMOption* options = new JavaVMOption[1];
    options[0].optionString =
"-Djava.class.path=/usr/local/jdk1.6.0/java";
    vm_args.version = JNI_VERSION_1_6;
    vm_args.nOptions = 1;
    vm_args.options = options;
    vm_args.ignoreUnrecognized = false;
    /* load and initialize a Java VM, return a JNI
interface
     * pointer in env */
    JNI_CreateJavaVM(&jvm,(void **)&env,
&vm_args);
    delete options;
    /* invoke the Main.test method using the JNI */
    jclass cls = env->FindClass("Main");
    jmethodID mid = env->GetStaticMethodID(cls,
"test", "(I)V");
    env->CallStaticVoidMethod(cls, mid, 100);
    /* We are done. */
    jvm->DestroyJavaVM();

  return EXIT_SUCCESS;
}

I'm stumped as to why JNI invocation appears not to work for
me on FreeBSD.

On Sunday 30 March 2008 01:53:52 Nick Johnson wrote:
> Yeah, it works.  Take a look at jsvc that ships with
Tomcat 6.  It binds
> to a port, drops root permission and creates a JVM and
does back and forth
> communication with Tomcat.
>
>    Nick
>
> On Sat, 29 Mar 2008, Rod wrote:
> > I'm having trouble using JNI software on FreeBSD.
> > In summary:
> > - I'm able to call native routines from a Java VM
via JNI
> > - However in the other direction JNI seems not to
work. I can't create a
> > JVM via JNI from native software.
> > Admittedly, I'm using one specific software (R
with rJava) and haven't
> > tried running my own JNI software.
> >
> > What I'm noticing is that a call to
JNI_CreateJavaVM () in
> > /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
results in SIGSYS, Bad
> > Sytem Call.
> >
> > Here's my output from running R with rJava under
gdb with a stack
> > backtrace. It all seems to go pear-shaped at
JNI_CreateJavaVM () :


_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

Re: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM fr
country flaguser name
Australia
2008-03-30 02:56:58
On Sat, Mar 29, 2008 at 06:36:11AM +0000, Rod wrote:
> I'm running this under a clean install of 7-Release
I386:
> 
> # uname -a
> FreeBSD  7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24
19:59:52 UTC
> 2008     rootlogan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC 
i386
> 
> I was getting the same result on my existing
installation, so in case it was
> some mix-up with libraries I tried new installations of
7-Release and also
> PCBSD-1.5 (based on 6.3), both with the same result.
> 
> I've tried Java 1.6 built from ports
(usr/ports/java/jdk16)
> 
> # java -version
> java version "1.6.0_03-p3"
> Java(TM) SE Runtime Environment (build
> 1.6.0_03-p3-root_16_feb_2008_09_59-b00)
> Java HotSpot(TM) Client VM (build
1.6.0_03-p3-root_16_feb_2008_09_59-b00,
> mixed mode)

So why is the build date from the JDK earlier than the build
date of your
kernel?  That makes me suspicious about it being something
to do with
removal of the KSE syscalls.

-- 
Greg Lewis                          Email   : glewiseyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewisFreeBSD.org
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

Re: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM fr
user name
2008-03-30 02:58:25
Further to the below, here's some more output:

#
# An unexpected error has been detected by Java Runtime
Environment:
#
#  SIGSEGV (0xb) at pc=0x28233838, pid=22317,
tid=0x28b01100
#
# Java VM: Java HotSpot(TM) Client VM (
1.6.0_03-p3-root_16_feb_2008_09_59-b00 mixed mode)
# Problematic frame:
# V  [libjvm.so+0x1b6838]
#
# An error report file with more information is saved as
hs_err_pid22317.log
#
# Please submit bug reports to freebsd-javaFreeBSD.org
#

Here's the log file:

#
# An unexpected error has been detected by Java Runtime
Environment:
#
#  SIGSEGV (0xb) at pc=0x28233838, pid=22317,
tid=0x28b01100
#
# Java VM: Java HotSpot(TM) Client VM (
1.6.0_03-p3-root_16_feb_2008_09_59-b00 mixed mode)
# Problematic frame:
# V  [libjvm.so+0x1b6838]
#
# Please submit bug reports to freebsd-javaFreeBSD.org
#

---------------  T H R E A D  ---------------

Current thread (0x28b22000):  JavaThread "main"
[_thread_in_vm,
id=682627328]

siginfo:si_signo=11, si_errno=0, si_code=1,
si_addr=0x00000000

Registers:
EAX=0x00000000, EBX=0x284492f8, ECX=0x28b1400c,
EDX=0x28b22000
ESP=0xbfbfe7e0, EBP=0xbfbfe838, ESI=0xbfbfe7f4,
EDI=0x28b22000
EIP=0x28233838, EFLAGS=0x00010282

Top of Stack: (sp=0xbfbfe7e0)
0xbfbfe7e0:   28b22000 28b22000 28b22000 2833605e
0xbfbfe7f0:   28b1400c 00000001 28b22000 284492f8
0xbfbfe800:   28b22000 28b220ec bfbfe848 2822a3dd
0xbfbfe810:   28b22000 28b14008 000004a4 28416fe8
0xbfbfe820:   0000000e 28b22000 00000000 00000001
0xbfbfe830:   bfbfe904 00000000 bfbfe868 08048a54
0xbfbfe840:   28b220ec 00000000 00000000 bfbfe87c
0xbfbfe850:   28b220ec 00000000 08048b19 08048b14

Instructions: (pc=0x28233838)
0x28233828:   02 00 00 8b 45 10 c7 45 e8 0e 00 00 00 8d 75
bc
0x28233838:   8b 10 8b 42 08 8b 52 0c 83 c2 1c 66 8b 40 26
51

Stack: [0xbfa00000,0xbfc00000),  sp=0xbfbfe7e0,  free
space=2041k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM
code, C=native
code)
V  [libjvm.so+0x1b6838]
C  [test3+0xa54]
C  [test3+0x961]
C  [test3+0x689]


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x28beb800 JavaThread "Low Memory Detector"
daemon [_thread_blocked,
id=682629632]
  0x28b28000 JavaThread "CompilerThread0" daemon
[_thread_blocked,
id=682629376]
  0x28b27000 JavaThread "Signal Dispatcher" daemon
[_thread_blocked,
id=682628608]
  0x28b25800 JavaThread "Finalizer" daemon
[_thread_blocked, id=682629120]
  0x28b24800 JavaThread "Reference Handler" daemon
[_thread_blocked,
id=682628864]
=>0x28b22000 JavaThread "main" [_thread_in_vm,
id=682627328]

Other Threads:
  0x28b23800 VMThread [id=682628352]
  0x28bec800 WatcherThread [id=682629888]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 960K, used 158K [0x2ac80000,
0x2ad80000,
0x2b160000)
  eden space 896K,  17% used [0x2ac80000, 0x2aca7830,
0x2ad60000)
  from space 64K,   0% used [0x2ad60000, 0x2ad60000,
0x2ad70000)
  to   space 64K,   0% used [0x2ad70000, 0x2ad70000,
0x2ad80000)
 tenured generation   total 4096K, used 0K [0x2b160000,
0x2b560000,
0x2ec80000)
   the space 4096K,   0% used [0x2b160000, 0x2b160000,
0x2b160200,
0x2b560000)
 compacting perm gen  total 12288K, used 1459K [0x2ec80000,
0x2f880000,
0x32c80000)
   the space 12288K,  11% used [0x2ec80000, 0x2edecf10,
0x2eded000,
0x2f880000)
No shared spaces configured.

Dynamic libraries:
0x08048000    
/mnt2/usr/home/rodney/cprog/test3/./src/test3
0x2807d000    
/usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
0x28862000     /lib/libthr.so.3
0x28875000     /usr/lib/libstdc++.so.6
0x2896a000     /lib/libm.so.5
0x2897f000     /lib/libgcc_s.so.1
0x2898a000     /lib/libc.so.7
0x28a90000    
/usr/local/jdk1.6.0/jre/lib/i386/native_threads/libhpi.so
0x28aa2000    
/usr/local/jdk1.6.0/jre/lib/i386/libverify.so
0x28aaf000     /usr/local/jdk1.6.0/jre/lib/i386/libjava.so
0x28ad6000     /usr/local/jdk1.6.0/jre/lib/i386/libzip.so
0x28adf000     /lib/libz.so.4
0x28049000     /libexec/ld-elf.so.1

VM Arguments:
java_command: <unknown>
Launcher Type: generic

Environment Variables:
PATH=/usr/local/gnu-autotools/bin:/sbin:/bin:/usr/sbin:/usr/
bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
LD_LIBRARY_PATH=/usr/local/lib/R/lib:/usr/local/jdk1.6.0/lib
:/usr/local/jdk1.6.0/jre/lib/i386:/usr/local/jdk1.6.0/jre/li
b/i386/client:/usr/local/lib/R/library/rJava/libs:/usr/local
/jdk1.6.0/jre/lib/i386/server
SHELL=/bin/csh
DISPLAY=:0
HOSTTYPE=FreeBSD
OSTYPE=FreeBSD
MACHTYPE=i386

Signal Handlers:
SIGSEGV: [libjvm.so+0x35e9c0], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGBUS: [libjvm.so+0x35e9c0], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGFPE: [libjvm.so+0x2a4bd0], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGPIPE: [libjvm.so+0x2a4bd0], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGILL: [libjvm.so+0x2a4bd0], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000,
sa_flags=0x00000000
SIGUSR2: [libjvm.so+0x2a6c10], sa_mask[0]=0x00000000,
sa_flags=0x00000042
SIGHUP: [libjvm.so+0x2a5c70], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGINT: [libjvm.so+0x2a5c70], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGQUIT: [libjvm.so+0x2a5c70], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGTERM: [libjvm.so+0x2a5c70], sa_mask[0]=0xfffefeff,
sa_flags=0x00000042
SIGUSR2: [libjvm.so+0x2a6c10], sa_mask[0]=0x00000000,
sa_flags=0x00000042


---------------  S Y S T E M  ---------------

OS:Bsd
uname:FreeBSD 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24
19:59:52 UTC
2008     rootlogan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
i386
rlimit: STACK 65536k, CORE infinity, NPROC 5547, NOFILE
11095
CPU:total 1 (1 cores per cpu, 1 threads per core) family 6
model 13 stepping
6, cmov, cx8, fxsr, mmx, sse, sse2

Memory: 4k page, physical 764700k(191175k free)

vm_info: Java HotSpot(TM) Client VM
(1.6.0_03-p3-root_16_feb_2008_09_59-b00)
for bsd-x86, built on Feb 16 2008 11:10:46 by
"root" with gcc
4.2.120070719  [FreeBSD]


I'm going to try rebuilding jdk16 again.

On Sun, Mar 30, 2008 at 6:45 AM, Rodney Hoskinson
<funkyrodgmail.com>
wrote:

> Nick
>
> Thanks,
>
> I'm still having trouble trying to invoke the JVM from
FreeBSD.
> I compiled and ran the simple C++ JNI invocation
program below, linked
> against
> jdk1.6.0 on FreeBSD7.0-Release. (Tried linking against
diablo-jdk1.5.0also -
> same result).
>
> I got the same result as trying to run rJava: Program
received signal
> SIGSYS
> (Bad system call).
>
>
>
> or in gdb:
>
> # gdb ./a.out
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public
License, and you
> are
> welcome to change it and/or distribute copies of it
under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type
"show warranty" for
> details.
> This GDB was configured as
"i386-marcel-freebsd"...(no debugging symbols
> found)...
> (gdb) run
> Starting program: /usr/home/test3/src/a.out
> (no debugging symbols found)...(no debugging symbols
found)...(no
> debugging
> symbols found)...(no debugging symbols found)...(no
debugging symbols
> found)...(no debugging symbols found)...[New LWP
100131]
> (no debugging symbols found)...[New Thread 0x28b01100
(LWP 100131)]
> (no debugging symbols found)...(no debugging symbols
found)...(no
> debugging
> symbols found)...(no debugging symbols found)...(no
debugging symbols
> found)...[New Thread 0x28b01300 (LWP 100192)]
> [New Thread 0x28b01500 (LWP 100193)]
> [New Thread 0x28b01600 (LWP 100203)]
>
> Program received signal SIGSYS, Bad system call.
> [Switching to Thread 0x28b01100 (LWP 100131)]
> 0x289bb86b in ksem_init () from /lib/libc.so.7
> (gdb) bt
> #0  0x289bb86b in ksem_init () from /lib/libc.so.7
> #1  0x289b1229 in sem_init () from /lib/libc.so.7
> #2  0x28321e59 in os::signal_init_pd ()
> from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
> #3  0x2831fb62 in os::signal_init ()
> from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
> #4  0x283aa342 in Threads::create_vm ()
> from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
> #5  0x2821b736 in JNI_CreateJavaVM ()
> from /usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so
> #6  0xbfbfe80b in ?? ()
> #7  0x00000000 in ?? ()
> #8  0x00000000 in ?? ()
> #9  0x00000000 in ?? ()
> #10 0xbfbfe868 in ?? ()
> #11 0xffffffff in ?? ()
> #12 0x28077000 in ?? ()
> #13 0x00000018 in ?? ()
> #14 0x28b0c000 in ?? ()
> #15 0x01bfe850 in ?? ()
> #16 0x00000001 in ?? ()
> #17 0xbfbfe8b0 in ?? ()
> #18 0x00000000 in ?? ()
> #19 0xbfbfe868 in ?? ()
> #20 0x080488ea in main ()
> (gdb)
>
>
> Invocation program,  built with compiler flags:
>
> -I/usr/local/jdk1.6.0/include
-I/usr/local/jdk1.6.0/include/freebsd
> -L/usr/local/jdk1.6.0/jre/lib/i386/server -ljvm
>
> #ifdef HAVE_CONFIG_H
> #include <config.h>
> #endif
>
>
>
> using namespace std;
>
> #include <iostream>
> #include <cstdlib>
> #include <jni.h>    /* where everything is
defined */
>
>
>
> int main(int argc, char *argv[])
> {
>
>    JavaVM *jvm;       /* denotes a Java VM */
>    JNIEnv *env;       /* pointer to native method
interface */
>    JavaVMInitArgs vm_args; /* JDK/JRE 6 VM
initialization arguments */
>    JavaVMOption* options = new JavaVMOption[1];
>    options[0].optionString =
"-Djava.class.path=/usr/local/jdk1.6.0/java";
>    vm_args.version = JNI_VERSION_1_6;
>    vm_args.nOptions = 1;
>    vm_args.options = options;
>    vm_args.ignoreUnrecognized = false;
>    /* load and initialize a Java VM, return a JNI
interface
>     * pointer in env */
>    JNI_CreateJavaVM(&jvm,(void **)&env,
&vm_args);
>    delete options;
>    /* invoke the Main.test method using the JNI */
>    jclass cls = env->FindClass("Main");
>    jmethodID mid = env->GetStaticMethodID(cls,
"test", "(I)V");
>    env->CallStaticVoidMethod(cls, mid, 100);
>    /* We are done. */
>    jvm->DestroyJavaVM();
>
>  return EXIT_SUCCESS;
> }
>
> I'm stumped as to why JNI invocation appears not to
work for me on
> FreeBSD.
>
> On Sunday 30 March 2008 01:53:52 Nick Johnson wrote:
> > Yeah, it works.  Take a look at jsvc that ships
with Tomcat 6.  It binds
> > to a port, drops root permission and creates a JVM
and does back and
> forth
> > communication with Tomcat.
> >
> >    Nick
> >
> > On Sat, 29 Mar 2008, Rod wrote:
> > > I'm having trouble using JNI software on
FreeBSD.
> > > In summary:
> > > - I'm able to call native routines from a
Java VM via JNI
> > > - However in the other direction JNI seems
not to work. I can't create
> a
> > > JVM via JNI from native software.
> > > Admittedly, I'm using one specific software
(R with rJava) and haven't
> > > tried running my own JNI software.
> > >
> > > What I'm noticing is that a call to
JNI_CreateJavaVM () in
> > >
/usr/local/jdk1.6.0/jre/lib/i386/client/libjvm.so results in
SIGSYS,
> Bad
> > > Sytem Call.
> > >
> > > Here's my output from running R with rJava
under gdb with a stack
> > > backtrace. It all seems to go pear-shaped at
JNI_CreateJavaVM () :
>
>
>
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

Re: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM fr
user name
2008-03-30 03:23:52
I built the jdk16 originally under a FreeBSD7.0 installation
that I had
updated to 7-Release from pre-release via
buildworld/buildkernel.

The output below was from running under a fresh install of
7.0-Releaseinstalled from the
7.0-Release binaries (from the CDs). I installed the jdk16
that I had built
under the older buildworlded 7.0-Release onto the fresh
binary installed
7.0-Release (which I installed clean specifically to
investigate this
problem).

I'm now rebuilding jdk16 under the fresh 7.0-Release to see
if that helps.

Thanks for your help so far everyone - I've posted some
further details
(output log from the invocation test program).

Greg I'm not sure what you're referring to regarding removal
of KSE
syscalls.  What would be the implications in this
situation?

I'm currently rebuilding jdk16 under the clean binary
install of 7-Release
(i386) to see if that helps.

Regards





On Sun, Mar 30, 2008 at 7:56 AM, Greg Lewis <glewiseyesbeyond.com> wrote:

> On Sat, Mar 29, 2008 at 06:36:11AM +0000, Rod wrote:
> > I'm running this under a clean install of
7-Release I386:
> >
> > # uname -a
> > FreeBSD  7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun
Feb 24 19:59:52 UTC
> > 2008     rootlogan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC 
i386
> >
> > I was getting the same result on my existing
installation, so in case it
> was
> > some mix-up with libraries I tried new
installations of 7-Release and
> also
> > PCBSD-1.5 (based on 6.3), both with the same
result.
> >
> > I've tried Java 1.6 built from ports
(usr/ports/java/jdk16)
> >
> > # java -version
> > java version "1.6.0_03-p3"
> > Java(TM) SE Runtime Environment (build
> > 1.6.0_03-p3-root_16_feb_2008_09_59-b00)
> > Java HotSpot(TM) Client VM (build
1.6.0_03-p3-root_16_feb_2008_09_59-b00
> ,
> > mixed mode)
>
> So why is the build date from the JDK earlier than the
build date of your
> kernel?  That makes me suspicious about it being
something to do with
> removal of the KSE syscalls.
>
> --
> Greg Lewis                          Email   :
glewiseyesbeyond.com
> Eyes Beyond                         Web     : http://www.eyesbeyond.com
> Information Technology              FreeBSD :
glewisFreeBSD.org
>
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

Re: Is JNI (Java Native Interface) Known to Work in Both Directions on FreeBSD (to invoke the JVM fr
country flaguser name
Australia
2008-03-30 10:16:25
On Sun, Mar 30, 2008 at 08:23:52AM +0000, Rod wrote:
> I built the jdk16 originally under a FreeBSD7.0
installation that I had
> updated to 7-Release from pre-release via
buildworld/buildkernel.
> 
> The output below was from running under a fresh install
of
> 7.0-Releaseinstalled from the
> 7.0-Release binaries (from the CDs). I installed the
jdk16 that I had built
> under the older buildworlded 7.0-Release onto the fresh
binary installed
> 7.0-Release (which I installed clean specifically to
investigate this
> problem).
>
> I'm now rebuilding jdk16 under the fresh 7.0-Release to
see if that helps.

Sounds like a sensible thing to try.

> Thanks for your help so far everyone - I've posted some
further details
> (output log from the invocation test program).
> 
> Greg I'm not sure what you're referring to regarding
removal of KSE
> syscalls.  What would be the implications in this
situation?

My bad, that has only happened in -current not in 7.x, so
ignore that.  I
was thinking of a reason that you'd get a SIGSYS (which
means you're
invoking a non-existent syscall).  Removal of the KSE
syscalls would fit
that, but it hasn't happened in 7.x so that can't be the
case.

-- 
Greg Lewis                          Email   : glewiseyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewisFreeBSD.org
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java

To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"

[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )