Hi ,
I am trying to run java with JNI interface over a shared library that uses
pcsc-lite 1.1.1 library.
a similar C code runs fine with the same pcsc library however running it via
JNI results the following JAVA debug message:
---------JAVA start main
before loading ar_jpk11
after loading ar_jpk11
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x40018f4c
Function name=pthread_cond_destroy
Library=/lib/libpthread.so.0
Current Java thread:
at COM.arx.jpkcs11.Native.AR_NativePKCS11.loadPKCS11Library(Native
Method)
at COM.arx.jpkcs11.Native.AR_NativePKCS11.<init>(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at COM.arx.jpkcs11.AR_JPKCS11.getInstance(Unknown Source)
at myTest.main(myTest.java:51)
Dynamic libraries:
08048000-0804c000 r-xp 00000000 03:04 96830
/usr/lib/SunJava2-1.3.1/bin/i386/native_threads/java
0804c000-0804d000 rw-p 00003000 03:04 96830
/usr/lib/SunJava2-1.3.1/bin/i386/native_threads/java
40000000-40012000 r-xp 00000000 03:04 11710 /lib/ld-2.2.5.so
40012000-40013000 rw-p 00011000 03:04 11710 /lib/ld-2.2.5.so
40014000-40022000 r-xp 00000000 03:04 11732 /lib/libpthread.so.0
40022000-40029000 rw-p 0000e000 03:04 11732 /lib/libpthread.so.0
40029000-40032000 r-xp 00000000 03:04 31351
/usr/lib/SunJava2-1.3.1/jre/lib/i386/native_threads/libhpi.so
40032000-40033000 rw-p 00008000 03:04 31351
/usr/lib/SunJava2-1.3.1/jre/lib/i386/native_threads/libhpi.so
40033000-40238000 r-xp 00000000 03:04 31327
/usr/lib/SunJava2-1.3.1/jre/lib/i386/client/libjvm.so
40238000-40339000 rw-p 00204000 03:04 31327
/usr/lib/SunJava2-1.3.1/jre/lib/i386/client/libjvm.so
40350000-40352000 r-xp 00000000 03:04 11720 /lib/libdl.so.2
40352000-40353000 rw-p 00001000 03:04 11720 /lib/libdl.so.2
40353000-40467000 r-xp 00000000 03:04 11716 /lib/libc.so.6
40467000-4046d000 rw-p 00113000 03:04 11716 /lib/libc.so.6
40472000-40484000 r-xp 00000000 03:04 11723 /lib/libnsl.so.1
40484000-40485000 rw-p 00011000 03:04 11723 /lib/libnsl.so.1
40487000-404a9000 r-xp 00000000 03:04 11721 /lib/libm.so.6
404a9000-404aa000 rw-p 00021000 03:04 11721 /lib/libm.so.6
404aa000-404ab000 r--p 00000000 03:04 13029
/usr/lib/locale/en_US/LC_IDENTIFICATION
404ab000-404ac000 r--p 00000000 03:04 13226
/usr/lib/locale/en_US/LC_MEASUREMENT
404ac000-404ad000 r--p 00000000 03:04 14138
/usr/lib/locale/en_US/LC_TELEPHONE
404ad000-404ae000 r--p 00000000 03:04 14131
/usr/lib/locale/en_US/LC_ADDRESS
404ae000-404af000 r--p 00000000 03:04 14137
/usr/lib/locale/en_US/LC_NAME
404af000-404b0000 r--p 00000000 03:04 13345
/usr/lib/locale/en_US/LC_PAPER
404b0000-404b1000 r--p 00000000 03:04 14135
/usr/lib/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES
404b1000-404b2000 r--p 00000000 03:04 13228
/usr/lib/locale/en_US/LC_MONETARY
404b2000-404b8000 r--p 00000000 03:04 14226
/usr/lib/locale/en_US/LC_COLLATE
404b8000-404b9000 r--p 00000000 03:04 13031
/usr/lib/locale/en_US/LC_TIME
404b9000-404f2000 r-xp 00000000 03:04 15861
/usr/lib/libstdc++-libc6.1-1.so.2
404f2000-404fe000 rw-p 00038000 03:04 15861
/usr/lib/libstdc++-libc6.1-1.so.2
40501000-40512000 r-xp 00000000 03:04 31348
/usr/lib/SunJava2-1.3.1/jre/lib/i386/libverify.so
40512000-40514000 rw-p 00010000 03:04 31348
/usr/lib/SunJava2-1.3.1/jre/lib/i386/libverify.so
40514000-40535000 r-xp 00000000 03:04 31339
/usr/lib/SunJava2-1.3.1/jre/lib/i386/libjava.so
40535000-40537000 rw-p 00020000 03:04 31339
/usr/lib/SunJava2-1.3.1/jre/lib/i386/libjava.so
40538000-4054c000 r-xp 00000000 03:04 31349
/usr/lib/SunJava2-1.3.1/jre/lib/i386/libzip.so
4054c000-4054f000 rw-p 00013000 03:04 31349
/usr/lib/SunJava2-1.3.1/jre/lib/i386/libzip.so
4054f000-41285000 r--s 00000000 03:04 31408
/usr/lib/SunJava2-1.3.1/jre/lib/rt.jar
412b2000-415a9000 r--s 00000000 03:04 31320
/usr/lib/SunJava2-1.3.1/jre/lib/i18n.jar
415a9000-415bf000 r--s 00000000 03:04 31414
/usr/lib/SunJava2-1.3.1/jre/lib/sunrsasign.jar
43667000-43668000 r--p 00000000 03:04 14209
/usr/lib/locale/en_US/LC_NUMERIC
43669000-4366a000 r-xp 00000000 03:04 56944 /lib/libobj_ids.so
4366a000-4366d000 rw-p 00000000 03:04 56944 /lib/libobj_ids.so
496cf000-496fa000 r--p 00000000 03:04 14203
/usr/lib/locale/en_US/LC_CTYPE
49766000-4977f000 r-xp 00000000 03:04 100920 /lib/libar_jpk11.so
4977f000-49780000 rw-p 00018000 03:04 100920 /lib/libar_jpk11.so
49780000-497d8000 r-xp 00000000 03:04 109714 /lib/libsadaptor.so
497d8000-497e7000 rw-p 00058000 03:04 109714 /lib/libsadaptor.so
497ef000-497fd000 r-xp 00000000 03:04 158123 /lib/libpcsclite.so
497fd000-497fe000 rw-p 0000e000 03:04 158123 /lib/libpcsclite.so
4980d000-498a6000 r-xp 00000000 03:04 15936 /usr/lib/libstdc++.so.5.0.0
498a6000-498bb000 rw-p 00098000 03:04 15936 /usr/lib/libstdc++.so.5.0.0
498c0000-498c7000 r-xp 00000000 03:04 14625 /lib/libgcc_s.so.1
498c7000-498c8000 rw-p 00007000 03:04 14625 /lib/libgcc_s.so.1
498c8000-498e5000 rw-s 00000000 00:05 6094850 /SYSV0304ac92 (deleted)
498e5000-49a43000 r-xp 00000000 03:04 56774 /lib/libarpkcs11.so
49a43000-49a74000 rw-p 0015d000 03:04 56774 /lib/libarpkcs11.so
49a75000-49aae000 r-xp 00000000 03:04 15860
/usr/lib/libstdc++-3-libc6.2-2-2.10.0.so
49aae000-49abf000 rw-p 00038000 03:04 15860
/usr/lib/libstdc++-3-libc6.2-2-2.10.0.so
Local Time = Sun Aug 17 17:03:49 2003
Elapsed Time = 0
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1_04-b02 mixed mode)
#
# An error report file has been saved as hs_err_pid31057.log.
# Please refer to the file for further information.
#
opening sharedObject libsadaptor.so
The strace run shows the following :
.....
....
open("/usr/lib/SunJava2-1.3.1/jre/../lib/i386/libstdc++-libc6.2-2.so.3",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libstdc++-libc6.2-2.so.3", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=58487, ...}) = 0
mmap2(NULL, 58487, PROT_READ, MAP_PRIVATE, 5, 0) = 0x497fe000
close(5) = 0
open("/usr/lib/libstdc++-libc6.2-2.so.3", O_RDONLY) = 5
read(5, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\251"..., 1024) =
1024
fstat64(5, {st_mode=S_IFREG|0555, st_size=376150, ...}) = 0
mmap2(NULL, 311652, PROT_READ|PROT_EXEC, MAP_PRIVATE, 5, 0) = 0x49a75000
mprotect(0x49aae000, 78180, PROT_NONE) = 0
mmap2(0x49aae000, 69632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 5,
0x38) = 0x49aae000
mmap2(0x49abf000, 8548, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x49abf000
close(5) = 0
mprotect(0x43669000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x43669000, 4096, PROT_READ|PROT_EXEC) = 0
mprotect(0x498e5000, 1433600, PROT_READ|PROT_WRITE) = 0
mprotect(0x498e5000, 1433600, PROT_READ|PROT_EXEC) = 0
getpid() = 31639
getpid() = 31639
munmap(0x497fe000, 58487) = 0
getpid() = 31639
getpid() = 31639
getpid() = 31639
open("/tmp/pcsc/.pcscpub", O_RDONLY) = 5
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0) = 0x4366d000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x1) = 0x4366e000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x2) = 0x4366f000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x3) = 0x497fe000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x4) = 0x497ff000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x5) = 0x49800000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x6) = 0x49801000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x7) = 0x49802000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x8) = 0x49803000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0x9) = 0x49804000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0xa) = 0x49805000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0xb) = 0x49806000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0xc) = 0x49807000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0xd) = 0x49808000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0xe) = 0x49809000
mmap2(NULL, 112, PROT_READ, MAP_SHARED, 5, 0xf) = 0x4980a000
socket(PF_UNIX, SOCK_STREAM, 0) = 6
connect(6, {sin_family=AF_UNIX, path="/tmp/pcsc/.pcscomm"}, 21) = -1
ECONNREFUSED (Connection refused)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No
such file or directory)
close(6) = 0
close(5) = 0
getpid() = 31639
--- SIGSEGV (Segmentation fault) ---
rt_sigaction(SIGSEGV, {0x4001d1b0, ~[], SA_RESTART|SA_SIGINFO|0x4000000},
{0x4001d1b0, ~[KILL STOP], SA_STACK|SA_RESTART|SA_SIGINFO|0x4000000}, 8) = 0
write(1, "\n", 1
) = 1
write(1, "An unexpected exception has been"..., 73An unexpected exception
has been detected in native code outside the VM.
) = 73
write(1, "Unexpected Signal : 11 occurred "..., 49Unexpected Signal : 11
occurred at PC=0x40018f4c
) = 49
write(1, "Function name=pthread_cond_destr"..., 35Function
name=pthread_cond_destroy
) = 35
write(1, "Library=/lib/libpthread.so.0\n", 29Library=/lib/libpthread.so.0
) = 29
write(1, "\n", 1
) = 1
....
....
....
It seems the pcsc-lite is not thread safe !!!
Did any one encounter such a problem with running JNI code with muscle?
Was he able to resolve it somehow ?
Thanks.
Gilad
_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.musclecard.com/mailman/listinfo/muscle