Problem with JNI in a Solaris shared library

Hi,
I have a problem.
I have used JNI in my .dll on Windows & .so on Solaris . I have also used the same JNI code in a .exe on Windows & an executable on Solaris. 3 out of the above 4 combinations work & 1 doesen't. When I use JNI from a .so on Solaris 8(with/without the J2SE recommended patch), the JVM seems to have some exception & dumps core when I invoke CreateJavaVM(). See Below - I've included the output on the screen & the output from 'pstack core' :
Unexpected Signal : 11 occurred at PC=0xFED29D44
Function=[Unknown. Nearest: JVM_GetMethodIxExceptionIndexes+0x1994]
Library=/usr/java/jre/lib/sparc/libjvm.so
Current Java thread:
Dynamic libraries:
0x10000 SblSim
0xff280000 /usr/lib/libnsl.so.1
0xfec00000 /usr/java/jre/lib/sparc/libjvm.so
0xff370000 /usr/lib/libpthread.so.1
0xff350000 /usr/lib/librt.so.1
0xff260000 /usr/lib/libsocket.so.1
0xff390000 /usr/lib/libdl.so.1
0xff230000 /usr/lib/libCrun.so.1
0xff200000 /usr/lib/libm.so.1
0xff340000 /usr/lib/libw.so.1
0xff1b0000 /usr/lib/libthread.so.1
0xff080000 /usr/lib/libc.so.1
0xff180000 /usr/lib/libmp.so.2
0xff160000 /usr/lib/libaio.so.1
0xff1f0000 /usr/platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1
0xfebd0000 /usr/j2se/jre/lib/sparc/native_threads/libhpi.so
0xfeba0000 /usr/j2se/jre/lib/sparc/libverify.so
0xfeb60000 /usr/j2se/jre/lib/sparc/libjava.so
0xfeb40000 /usr/j2se/jre/lib/sparc/libzip.so
0xfe920000 /usr/lib/locale/en_US.ISO8859-1/en_US.ISO8859-1.so.2
0xf1400000 ./libaicd.so
0xfc480000 ./libmttoolkit.so
0xfdfe0000 ./libmttlogger.so
0xfdfb0000 /usr/j2se/jre/lib/sparc/libnet.so
Local Time = Tue Nov 12 09:51:37 2002
Elapsed Time = 29
# HotSpot Virtual Machine Error : 11
# Error ID : 4F530E43505002D5 01
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode)
# An error report file has been saved as hs_err_pid3120.log.
# Please refer to the file for further information.
Abort(coredump)
Below is the output of 'pstack core'
$ pstack core
core 'core' of 3120: SblSim libaicd.so 127.0.0.1 9999
----------------- lwp# 1 / thread# 1 --------------------
ff1c9764 __sigprocmask (ff1cbf60, 0, 0, 565f8, ff1de000, 0) + 8
ff1be110 _sigon   (565f8, ff1e5930, 6, ffbedba4, 565f8, 6) + d0
ff1c1150 thrpkill (0, 1, 6, ff1de000, 1, ff140450) + f8
ff0cb900 raise (6, 0, 0, ffffffff, ff1403bc, 4) + 40
ff0b58ec abort (ff13c000, ffbedcf8, 0, fffffff8, 4, ffbedd19) + 100
feee2700 ???????? (1, fef98e50, ffbedd98, 0, feffc130, feee1258)
feee12c8 ???????? (60650, b, fed29d44, ffbeeab8, b, 0)
fede77c0 ???????? (fed29d44, ffbeeab8, ffbee800, fed29d44, fed03744, 0)
ff1cb824 __sighndlr (b, ffbeeab8, ffbee800, fede6f38, 5669c, 5668c) + c
ff1c84d8 sigacthandler (b, 565f8, 0, 0, 0, ff1de000) + 708
--- called from signal handler with signal 11 (SIGSEGV) ---
fed29d44 ???????? (0, 60650, 0, 0, 0, 0)
fed2d7d4 ???????? (606e4, 0, 0, ffbeed00, 0, 0)
f172e818 __1cHJNIEnv_JNewObject6MpnH_jclass_pnK_jmethodID_E_pnI_jobject__ (606e4, 0, 0, ffbeed70, 39, 107f90) + 70
f172dbf8 __1cGJEvent2t5B6M_v_ (107f60, f1a877f4, db088, ff0c1c44, 107f48, 0) + 80
f16f2864 __1cGCEvent2t6Mii_v_ (107f60, 0, 1, ff13c000, 107f48, 0) + 7c
f16e62e8 __1cVCISCHelperThreadMutex2t6M_v_ (107f50, 0, 560ac, 30f68, fefe4000, 0) + c0
f16ddc34 __1cLinitGlobals6F_v_ (0, 1, 19a, f1a198ec, f1a198ec, 0) + 5c
f16de4e4 CreateISCDriverInstance (0, 5cc40, 0, 57608, 565e8, 0) + 554
00034f08 __1cJRunSblSim6F_v_ (1, ffbef322, ffbef32c, ff13fc70, 100d4, 0) + 320
00035588 main (4, ffbef1dc, ffbef1f0, 55c00, 0, 0) + 1a8
00018460 _start   (0, 0, 0, 0, 0, 0) + 108
----------------- lwp# 2 / thread# 2 --------------------
ff11e958 _signotifywait (ff1de000, 59, 0, 0, 0, 0) + 8
ff1c2030 thr_yield (0, 0, 0, 0, 0, 0) + 8c
----------------- lwp# 3 --------------------------------
ff1c9774 private___lwp_cond_wait (ff075d70, ff1ded9c, ff1de000, 0, 0, 4) + 8
ff11c554 doorreturn (ff075cb0, ff1ba740, 0, 0, 0, 0) + 68
----------------- lwp# 4 / thread# 4 --------------------
ff11efbc ___lwp_cond_wait (60048, 60030, fe901ad0, 0, 0, fe901ac8) + 8
ff116610 lwpcond_timedwait (1cb8c88, 3dd1157a, fe901ba4, 60030, 60048, 1) + 98
fecfc7d8 ???????? (0, 1, 0, 581b8, feffa26c, 0)
fecfcfd4 ???????? (ff00a15c, feffa4b8, feffa4b4, 0, 0, 0)
fecfccc0 ???????? (d3980, 0, 0, 0, 0, 0)
fecfcbd0 ???????? (d3980, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (d3980, 0, 0, 0, 0, 0) + 40
----------------- lwp# 5 --------------------------------
ff11c4fc doorreturn (4, ff1df688, ff1df6a0, 3, ff1de000, 1) + 10
ff1ba740 lwpstart (fea95d70, 0, 6000, ff075b74, 0, 0) + 18
ff1c2030 thr_yield (0, 0, 0, 0, 0, 0) + 8c
----------------- lwp# 6 / thread# 5 --------------------
ff11efbc ___lwp_cond_wait (d5720, d5708, 0, fed10a40, 0, 0) + 8
fed110d4 ???????? (d56c8, 0, 5000, 5210, d4d38, 4d24)
fed10824 ???????? (fdf8172c, 0, 0, d4d38, d4d38, 30dec8)
fed103b0 ???????? (d4dcc, fdf81824, 0, 0, 0, 0)
fa40cc94 ???????? (f2000380, b6, fdf818a4, ffffffff, 0, fdf817c0)
fa405da0 ???????? (f2000380, b6, fdf818a8, fa415444, 0, fdf81840)
fa405da0 ???????? (fdf81938, 0, 0, fa4157a4, 2f4210, fdf818d8)
fa400438 ???????? (fdf819c0, fdf81c08, a, f6050b68, fa40bc8c, fdf81b50)
fecfe2f8 ???????? (fdf81c00, fdf81a88, fdf81b48, d4d38, d4d38, fdf81a9c)
fed0ff90 ???????? (fefe4000, d5298, fdf81b3c, fdf81b38, fdf81b48, d4d38)
fed0fdf0 ???????? (fdf81c00, fdf81bfc, fdf81bf0, fdf81be8, fdf81be0, d4d38)
fed0fd78 ???????? (d4d38, d4d38, ac9a0, d5298, 2d4488, fed0fa60)
fed0fa88 ???????? (d4d38, 0, 0, 0, 0, 0)
fecfcbd0 ???????? (d4d38, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (d4d38, 0, 0, 0, 0, 0) + 40
----------------- lwp# 7 / thread# 6 --------------------
ff11efbc ___lwp_cond_wait (d7040, d7028, 0, 1, 0, 0) + 8
fed110d4 ???????? (d6fe8, 0, 5000, 5210, d6658, 4d24)
fed10824 ???????? (fa38169c, 0, 0, d6658, d6658, 30dec8)
fed103b0 ???????? (d66ec, fa38179c, 0, 0, 0, 0)
fa40cc94 ???????? (f2000490, b6, fa3817a0, fa414050, 0, fa381730)
fa405da0 ???????? (f2000478, b6, fa3818b4, fa415444, 0, fa3817d8)
fa405c4c ???????? (f2000478, b6, fa381934, fa415444, d6658, fa381858)
fa405c4c ???????? (fa381938, 0, 0, fa38197c, 2f4210, fa3818d8)
fa400438 ???????? (fa3819c0, fa381c08, a, f60520b8, fa40bc8c, fa381b50)
fecfe2f8 ???????? (fa381c00, fa381a88, fa381b48, d6658, d6658, fa381a9c)
fed0ff90 ???????? (fefe4000, d6bb8, fa381b3c, fa381b38, fa381b48, d6658)
fed0fdf0 ???????? (fa381c00, fa381bfc, fa381bf0, fa381be8, fa381be0, d6658)
fed0fd78 ???????? (d6658, d6658, ac9e0, d6bb8, 2d4488, fed0fa60)
fed0fa88 ???????? (d6658, 0, 0, 0, 0, 0)
fecfcbd0 ???????? (d6658, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (d6658, 0, 0, 0, 0, 0) + 40
----------------- lwp# 8 / thread# 7 --------------------
ff11d194 _poll    (0, 0, 0, fa281a28, ff13f1b4, fa281a28) + 8
ff1cb134 select (0, a, 0, ff1de000, fa281e14, 0) + 34
fed32afc ???????? (d8040, 0, a, 0, 0, 0)
fed328b4 ???????? (d8040, 0, 0, 0, 0, 0)
fecfcbd0 ???????? (d8040, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (d8040, 0, 0, 0, 0, 0) + 40
----------------- lwp# 9 / thread# 8 --------------------
ff11efbc ___lwp_cond_wait (5f998, 5f980, 2e7aa0, ff1de000, fa181e14, 0) + 8
fecfc634 ???????? (5f950, 0, 0, 0, feffa26c, 0)
fed3371c ???????? (3c00, 3f44, 0, 0, 0, 0)
fecfcbd0 ???????? (d81a8, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (d81a8, 0, 0, 0, 0, 0) + 40
----------------- lwp# 10 / thread# 9 --------------------
ff11f008 lwpsema_wait (f1f81e30, ff1de000, 0, f1f81d70, ff3e2628, 0) + c
ff1b94c0 _swtch   (f1f81d70, ffffffff, ff1de000, 5, 1000, 0) + 158
ff1bcc64 sema_wait (ff020fe0, ff1e98e4, 5000, 10000, 534d, 1) + bc
fed345c8 ???????? (0, 6, b, a, 1, 0)
fed34254 ???????? (ff002ae4, ff00a5a0, ff00a5d4, dab90, 2d4488, fed0fa60)
fed0fa88 ???????? (da630, 0, 0, 0, 0, 0)
fecfcbd0 ???????? (da630, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (da630, 0, 0, 0, 0, 0) + 40
----------------- lwp# 11 / thread# 10 --------------------
ff11efbc ___lwp_cond_wait (604e8, 604d0, 2e7aa0, feffa26c, 106c40, 0) + 8
fecfc88c ???????? (604a0, 0, 0, dbbd0, feffa26c, 0)
fed349ac ???????? (db670, db670, dbfd0, dbbd0, 2d4488, fed0fa60)
fed0fa88 ???????? (db670, 0, 0, 0, 0, 0)
fecfcbd0 ???????? (db670, ff1df688, 1, 1, ff1de000, 0)
ff1cb728 threadstart (db670, 0, 0, 0, 0, 0) + 40
-------------------------- thread# 3 --------------------
ff1bddbc reapwait (ff1e29e0, 20520, 0, ff1de000, 0, 0) + 38
ff1bdb14 _reaper  (ff1dee30, ff1e4740, ff1e29e0, ff1dee08, 1, fe400000) + 38
ff1cb728 threadstart (0, 0, 0, 0, 0, 0) + 40

This is an update to the original message -
I have tried both HotSpot & Server JVMs but still see the
same behavior. I'm using 1.4 .
I'd like to provide more information to those who can help
me. I have a feeling there might be something wrong in my
CC options. Thus you will find below what my CC statement
looks like for one of the files in my project & for the
linking of the final shared library. I also have
provided the output of ldd on my shared library libaicd.so
& for comparison the output of ldd on libjvm.so as that
might provide some usefull information just incase
something looks suspecious & might ring a bell.
/opt/SUNWspro.cc6/bin/CC -c -KPIC -g -DDEBUG=DEBUG -
D_DEBUG -mt -DSOLARIS -DSTD_STREAM -
I/vob1/qwsrc/fw/include -I.-I/vob4/source/idl -
I/vob4/source/mttoolkit -I/vob4/source/mttoolkit/tools -
I/vob4/source/integrations/siebel/aicd -
I/vob4/source/include -I/vob1/qwsrc/fw/include -
I/vob4/source/source -I/vob4/source/mttoolkit -
I/vob1/external/platform_neutral/siebel/scapi/include -
I/external/sparc/Sun/jdk/1.3.1/include -
I/external/sparc/Sun/jdk/1.3.1/include/solaris -
I/vob4/source/idl -I/vob4/source/mttoolkit -
I/vob4/source/mttoolkit/tools -
I/vob4/source/mttoolkit/vnet -
I/vob4/source/mttoolkit/bool -DUNIX -
D_USE_MTTServerToolkit -D_JAVA_ WIAcceptTimeOut.cpp -
o /space/users/janak/buildoutput/sparc/debug/obj/integratio s/siebel/aicd/WIAcceptTimeOut.o
/opt/SUNWspro.cc6/bin/CC -G -
o /space/users/janak/buildoutput/sparc/debug/lib/fw/libaicd.so
/space/us
ers/janak/buildoutput/sparc/debug/obj/integrations/siebel/ai
cd/AgentService.o /space/users/janak/buildoutput/sparc/debug
/obj/integrations/siebel/aicd/AgentServiceCmds.o /space/user
s/janak/buildoutput/sparc/debug/obj/integrations/siebel/aicd
/AgentServiceEvents.o /space/users/janak/buildoutput/sparc/d
ebug/obj/integrations/siebel/aicd/AgentServiceICAReq.o /spac
e/users/janak/buildoutput/sparc/debug/obj/integrations/siebe
l/aicd/AgentServiceICEvents.o /space/users/janak/buildoutput
/sparc/debug/obj/integrations/siebel/aicd/AgentServiceUtilit
ies.o /space/users/janak/buildoutput/sparc/debug/obj/integra
tions/siebel/aicd/AvMc.o /space/users/janak/buildoutput/spar
c/debug/obj/integrations/siebel/aicd/InternationalStrings.o
/space/users/janak/buildoutput/sparc/debug/obj/integrations/
siebel/aicd/JEvent.o /space/users/janak/buildoutput/sparc/de
bug/obj/integrations/siebel/aicd/JMultipleEvents.o /space/us
ers/janak/buildoutput/sparc/debug/obj/integrations/siebel/ai
cd/JNIObject.o /space/users/janak/buildoutput/sparc/debug/ob
j/integrations/siebel/aicd/JObject.o /space/users/janak/buil
doutput/sparc/debug/obj/integrations/siebel/aicd/JSemaphore.
o /space/users/janak/buildoutput/sparc/debug/obj/integration
s/siebel/aicd/JWorkerThread.o /space/users/janak/buildoutput
/sparc/debug/obj/integrations/siebel/aicd/MultipleEvents.o /
space/users/janak/buildoutput/sparc/debug/obj/integrations/s
iebel/aicd/Param.o /space/users/janak/buildoutput/sparc/debu
g/obj/integrations/siebel/aicd/ParamQueue.o /space/users/jan
ak/buildoutput/sparc/debug/obj/integrations/siebel/aicd/RefC
ount.o /space/users/janak/buildoutput/sparc/debug/obj/integr
ations/siebel/aicd/SiebelDriver.o /space/users/janak/buildou
tput/sparc/debug/obj/integrations/siebel/aicd/SiebelEvent.o
/space/users/janak/buildoutput/sparc/debug/obj/integrations/
siebel/aicd/SiebelWorkItem.o /space/users/janak/buildoutput/
sparc/debug/obj/integrations/siebel/aicd/SingleEvent.o /spac
e/users/janak/buildoutput/sparc/debug/obj/integrations/siebe
l/aicd/SmartPtr.o /space/users/janak/buildoutput/sparc/debug
/obj/integrations/siebel/aicd/StdAfx.o /space/users/janak/bu
ildoutput/sparc/debug/obj/integrations/siebel/aicd/ThreadPoo
l.o /space/users/janak/buildoutput/sparc/debug/obj/integrati
ons/siebel/aicd/Utilities.o /space/users/janak/buildoutput/s
parc/debug/obj/integrations/siebel/aicd/WIAcceptTimeOut.o -
lnsl -lc -lCstd -
L/space/users/janak/buildoutput/sparc/debug/lib/cti -
lmttoolkit -
L/space/users/janak/buildoutput/sparc/debug/lib/fw -
lmttlogger -
L/space/users/janak/buildoutput/sparc/debug/lib/fw -
lqwlicmtt -
L/external/sparc/Sun/jdk/1.3.1/jre/lib/sparc/server -
Bdynamic -ljvm -mt -lpthread -lposix4
$ ldd /usr/j2se/jre/lib/sparc/libjvm.so
libCrun.so.1 => /usr/lib/libCrun.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libthread.so.1 => /usr/lib/libthread.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libnsl.so.1 => /usr/lib/libnsl.so.1
libm.so.1 => /usr/lib/libm.so.1
libw.so.1 => /usr/lib/libw.so.1
libc.so.1 => /usr/lib/libc.so.1
libmp.so.2 => /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1
$ ldd libaicd.so
libnsl.so.1 => /usr/lib/libnsl.so.1
libc.so.1 => /usr/lib/libc.so.1
libmttoolkit.so => ./libmttoolkit.so
libmttlogger.so => ./libmttlogger.so
libjvm.so => /usr/java/jre/lib/sparc/libjvm.so
libpthread.so.1 => /usr/lib/libpthread.so.1
librt.so.1 => /usr/lib/librt.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libmp.so.2 => /usr/lib/libmp.so.2
libCrun.so.1 => /usr/lib/libCrun.so.1
libthread.so.1 => /usr/lib/libthread.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libm.so.1 => /usr/lib/libm.so.1
libaio.so.1 => /usr/lib/libaio.so.1
libw.so.1 => /usr/lib/libw.so.1
/usr/platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1

Similar Messages

  • Awkward problems with JNI on J2SE 5.0

    I'm experiencing a strange problem with JNI and I hope someone can help me out.I've installed Cygwin, MinGW and then the CDT plug-in for Eclipse C/C++ development. This means I've used the MinGW make utility. It successfully creates the DLL file, but for some awkward reason, function www_tutorial_jni_HelloWorld_displayHelloWorld cannot be found (UnsatisfiedLinkError: displayHelloWorld).
    The Java class looks like this:
    package www.tutorial.jni;
    public class HelloWorld {
        public native void displayHelloWorld();
        static {
            System.loadLibrary("hello");
        public static final void main(String[] args) {
             try {
                  HelloWorld hw = new HelloWorld();
                  hw.displayHelloWorld();
             } catch (Exception e) {
                  System.out.println(e.toString());
    }The header that was generated by javah.exe (version 1.5.0_01) looks like this:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class www_tutorial_jni_HelloWorld */
    #ifndef _Included_www_tutorial_jni_HelloWorld
    #define _Included_www_tutorial_jni_HelloWorld
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     www_tutorial_jni_HelloWorld
    * Method:    displayHelloWorld
    * Signature: ()V
    JNIEXPORT void JNICALL
    Java_www_tutorial_jni_HelloWorld_displayHelloWorld
      (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endifThe C++ implementation looks like this:
    #include <jni.h>
    #include "www_tutorial_jni_HelloWorld.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL
    Java_www_tutorial_jni_HelloWorld_displayHelloWorld(JNIEnv
    *env, jobject obj)
        printf("Hello world!\n");
        return;
    }I've made sure that the fully qualified name of the implementation function is identical to the one in the header. I don't understand why I still get the error; especially since checking the DLL reveals that a function called "Java_www_tutorial_jni_HelloWorld_displayHelloWorld" exists.
    Could someone try and produce a successfull DLL/SO from the C++ code and then try and run the Java part on a 5.0 version of Java? I'm really curious as to what on Earth is going on...

    ... Otherwise, I would have
    to add whatever directory I put my DLL into to the
    PATH variable.Not necessarily. I believe the "PATH" also implicitly includes the "current directory". I also think that most JNI users put their DLL in a directory from which they also launch java (so it's in the current directory).
    >
    ... a java.library.path set.
    If I don't explicitly set a Java library path,
    Eclipse can't even find the DLL. I'm beginning to
    believe that Eclipse somehow screws up running Java
    programs with native code...I don't know about that... Probably just something extra you have to do with your Eclipse project so that it can find the DLL.
    But like I said, I don't really know - just trying to throw out ideas, small as they may be.

  • Problem with Mac OSX Magic Mouse in Library

    Dear Freinds,
    me and some colleques, we got a problem with Apples Magic Mouse and Lightrooms Library: If the mouse is on the big picture of LRs Library, and you are swiping or wiping on the mouse only a very little, a lot of pictures are scrolling very fast, much to fast to handle.
    This happens often without any purpose and that´s very annoying, because you have to search the picture again, that you worked with.
    I think this is a bug of Lightroom, but I didn´t found a solution anywere.
    Is there any?
    Thanks
    Marco

    This behavior was also in Lr4 and maybe Lr3.  The swiping with the magic mouse is oversensitive in a few other programs also.   It is pretty annoying but I have finally got used to being careful with the swipe in Library on the big photo.  I would think Adobe could adjust the speed for this but Apple should allow the user more options in the mouse settings panel.  Apple seems to be going in the negative direction of letting the user customize the interface as they keep taking more setting features out.  In their typical arrogance, it seems that they think Apple knows best and the users can just deal with it.

  • Problem with JNI (custom shared library) on App Server

    We have a custom built shared library (.so) we want to use with the app server (a webapp). The .so is wrapped with java class and works to spec when tested outside of app server (webapp) environment with test stub. When wrapper class is introduced to App Server (webapp) & embedded function is invoked we recieve java.lang.UnsatisfiedLinkError(). We've looked to make sure $LD_LIBRARY_PATH is correct but still recieve this exception. Any suggestions? Running nm against the .so shows undefined symbols but these should be resolved by $LD_LIBRARY_PATH. Any suggestions?

    what version of appserver are u using...if 7.0 then try using their common class loader as per this docs:
    http://docs.sun.com/source/817-2171-10/dgdeploy.html#wp69906

  • Problem with JNI for target armlinux

    Dear friends,
    We have compiled CVM for ARM Linux and it is working fine for java programs as well as C programs.
    But when I try to make shared library out of a sample hello world JNI program for arm linux it says 'jni.h: No such file or directory' and after that many lines 'syntax error' and 'parse error' etc.
    But the same program is running fine on x86 linux. Problem only while cross compiling for arm linux. It is not problem with arm-v5t-le-gcc because that is working fine. Problem is with what I need to include in makefiles.
    As I am new to this domain could anyone help me where I am missing?
    Regards
    Kishore

    I'm not exactly sure what you're talking about, but it sounds like you may need to look into global references. Look at NewGlobalRef() and DeleteGlobalRef() and see if those help you out.
    God bless,
    -Toby Reyelts
    For all your JNI woes, check out Jace - http://jace.reyelts.com/jace

  • NT DLL to Solaris Shared Library;  C++ Exceptions

    I have written a "plugin" DLL for a third party product that runs on NT. In my plugin I use C++ exception handling and it works wonderfully :-)
    I am now trying to port my plugin so that it will work with the same third party product, but this time running on Solaris.
    I knew I was going to have to port my DLL to Solaris and so made sure I did not use any Win32 specific anything. My code compiles & links fine on Solaris. For the most part it even works correctly.
    The problem I have is that my code is not catching any of the exceptions it is throwing.
    Section 5.14 of the C++ Programming Guide says that for exception handling to work in a shared library, it must be loaded with the RTLD_GLOBAL flag passed to the dlopen() function used to load the shared library.
    Of course since the dlopen() function is in a third party product I have no way of knowing whether this parameter is being passed to the dlopen() function or not .. and more importantly I have no way of forcing it to be so.
    So ultimately I guess the question for the more experienced shared library writers is .. do you just not use C++ exception mechanism because you can not force your shared library to be opened with the proper parameter to dlopen() .. or is there something else I can do to enable C++ exceptions in my shared library.

    All works fine!...
    $ mkdir /tmp/xxx
    $ cat > dllfile.c
    $ cat > dlluser.c
    $ gcc -fPIC -c dllfile.c
    $ gcc -shared -W1,-soname,libdllfile.so.1 -o libdllfile.so dllfile.o
    $ gcc -o prog dlluser.c -ldl
    $ ls -l
    total 56
    -rw-r--r-- 1 xxxxxx users 80 &#1040;&#1087;&#1088; 8 17:04 dllfile.c
    -rw-r--r-- 1 xxxxxx users 908 &#1040;&#1087;&#1088; 8 17:15 dllfile.o
    -rw-r--r-- 1 xxxxxx users 368 &#1040;&#1087;&#1088; 8 17:03 dlluser.c
    -rwxr-xr-x 1 xxxxxx users 5260 &#1040;&#1087;&#1088; 8 17:15 libdllfile.so
    -rwxr-xr-x 1 xxxxxx users 6412 &#1040;&#1087;&#1088; 8 17:16 prog
    $
    $ file *
    dllfile.c:     c program text
    dllfile.o:     ELF 32-bit MSB relocatable SPARC Version 1
    dlluser.c:     c program text
    libdllfile.so:     ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically linked, not stripped
    prog:          ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped
    $
    $ su
    Password:
    # mkdir -p /root/shared_library/
    # cp libdllfile.so /root/shared_library/
    # exit
    $ ./prog
    With the changes
    library loaded
    Inside function
    $

  • Problem with JNI hello world

    I found some tutorial on SUN site on how to use JNI. I'm using Eclipse to compije Java and C (via Cygwin) files. Here are complete files:
    Hello.java:
    class Hello
         public native void sayHello();
         static
              try
              System.loadLibrary("hello");
              catch(Exception e)
                   System.out.println("exc");
         public static void main(String[] args)
              Hello h = new Hello();
              h.sayHello ();
    }Hello.c:
    #include <mingw/_mingw.h> //because there are some types needed for JNI
    #include <jni.h>
    #include "Hello.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_Hello_sayHello
      (JNIEnv *env, jobject obj)
         printf("Hello world!\n");
         return;
    }Makefile:
    hello.dll : Hello.o Hello.def
         gcc -g -shared -Wl,--kill-at -o hello.dll Hello.o hello.def
    Hello.o : Hello.c Hello.h
         gcc -c -g -I"$(JAVA_HOME)\include" -I"$(JAVA_HOME)\include\win32" Hello.c -o Hello.o
    Hello.h : Hello.class
         javah -jni Hello
    clean :
         rm Hello.h
         rm Hello.o
         rm hello.dllHello.def
    EXPORTS
    Java_Hello_sayHelloEverything goes well, but when I run java program it does nothin (it should print message, but it just exit without any error).I'm sure that it's something stupid, but I cant see what. Can anyone tell me what am I doing wrong?
    Thenks.

    Answer 1: yes, there was no problem. I compiled and started simple 'hello world' program from Cygwin and from WinXP console, and it worked well.
    Answer 2: This is weird, I changed code to this:
    Hello.java:
         public native int getInt();
              System.out.println("Returned int is " + h.getInt());Hello.c:
    JNIEXPORT jint JNICALL Java_Hello_getInt
      (JNIEnv *env, jobject obj)
         return 25;
    }It does not print anything. I started this program from Cygwin and from WinXP console, and from Eclipse. Only if I debug in Eclipse (step by step) I get:
    Returned int is 25and still I don't get Hello string printed (even if I go step by step). It looks like cygwin has some problem with OS. Do you have any idea what to do, I'm a bit confused?
    Thank you.
    Message was edited by:
    zly

  • Problem with JNI form C++

    Hi all,
    I'm fairly new to programming with JNI, so please excuse me if I ask a dumb question.
    I'm trying to call a Java method from a C++ class, but when I run the program, it throws an error, crashing the program. I'm pretty sure the problem is that the call to env->getMethodID() is throwing an error. I have looked around to try and find a way call a function with no arguments, but all of the examples that I have found all call a Java main.
    I'll post my code and the error message below so that things are a bit clearer.
    Thanks,
    Robert.
    Here is the main.cpp. This is where the program is started.
    #include "/usr/lib/jvm/java-6-sun-1.6.0.06/include/jni.h"
    int main()
       JNIEnv *env;
       JavaVM *jvm;
       jint res;
       jclass cls;
       jmethodID mid;
       // creation of the JVM
       JavaVMInitArgs vm_args;
       JavaVMOption options[1];
       options[0].optionString = "-Djava.class.path= .";
       vm_args.version = 0x00010002;
       vm_args.options = options;
       vm_args.nOptions = 1;
       vm_args.ignoreUnrecognized = JNI_TRUE;
       res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
       // now the rest of the code can work
       cls = env->FindClass("Test");
       mid = env->GetMethodID(cls, "run", "()V");
       env->CallVoidMethod(cls, mid);
       jvm->DestroyJavaVM();
    }Here is Test.java
    public class Test
       public void run()
          System.out.println("stuff");
          foo();
       public void foo()
          System.out.println("asdfasdf");
    }And here is the error message.
    # An unexpected error has been detected by Java Runtime Environment:
    #  SIGSEGV (0xb) at pc=0x06245f7d, pid=9054, tid=1076641792
    # Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing linux-x86)
    # Problematic frame:
    # V  [libjvm.so+0x245f7d]
    # An error report file with more information is saved as:
    # /media/MY STICK/jni/cpp/hs_err_pid9054.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    AbortedEdited by: metaldrummer610 on Apr 23, 2008 8:35 PM

    Yeah, so I just figured out what was wrong. I wasn't calling main from in Java. My bad guys.

  • Problem with native ldapsearch in Solaris 10

    Hi all,
    someone could tell me please why native ldapsearch in Solaris 10 do not work with SSL connection when same command comes with Sun Directory Server 5.2 works perfectly ?
    With native ldapsearch in Solaris 10, I get the error message "Can't contact LDAP server":
    # /bin/ldapsearch -v -h ldapserver -p 636 -Z -P /var/ldap -b dc=exemple,dc=fr -s base objectclass=\*
    ldap_init( ldapserver, 636 )
    filter pattern: objectclass=*
    returning: ALL
    filter is: (objectclass=*)
    ldap_search: Can't contact LDAP server
    When, on the same host, on which Directory server is installed, there's no problem:
    # /var/opt/mps/serverroot/shared/bin/ldapsearch -v -h ldapserver -p 636 -Z -P /var/ldap -b dc=exemple,dc=fr -s base objectclass=\*
    ldap_init( exemple, 636 )
    ldaptool_getcertpath -- /var/opt/mps/serverroot/alias
    ldaptool_getkeypath -- /var/opt/mps/serverroot/alias
    ldaptool_getdonglefilename -- (null)
    filter pattern: objectclass=*
    returning: ALL
    filter is: (objectclass=*)
    version: 1
    dn: dc=exemple,dc=fr
    nisDomain: exemple.fr
    objectClass: top
    objectClass: domain
    objectClass: nisDomainObject
    1 matches
    What can I do to bind to ldap server with SSL connection from an ordinary work station?
    Thank you in advance.
    Dra

    Hi :
    "The /usr/bin/ldapsearch is an old version that does not support the "-Z" and "-P" flags to test SSL connection on port 636, use the ldapsearch command from SUN DS5.0/5.1 that comes bundled with Solaris9 and usually installed at /usr/iplanet/ds5 (DS5.0/5.1) or /var/Sun/mps (DS5.1/5.2) or /var/opt/mps/serverroot (DS5.2)"
    Source : http://forums.sun.com/thread.jspa?threadID=5089467
    Hope this can help,
    Regards,
    Groucho_fr

  • Problem with JNI and Parallel Port dll

    Hi. I'm doing some testes with JNI. Firs i followed the netbeans tutorial for doing a C programa that prints somthing for java.. like.. "Hello java from C".
    So i tried to load a dll from my dll. Like, I have this dll to use the parallel port on windows Xp. So i created a dll to access it an comunicates eoth java.
    I did everything just fine.
    When I start my Java app, the first thing it does is to load this parallel port dll and configure the functions of it.
    After that .. I get this error
    EXCEPTION_FLT_STACK_CHECK (0xc0000092) at pc=0x0093d269, pid=2284, tid=3000
    Can someone explain why ?
    (Sorry if i wasn't clear enough, english is not my native language, so ask if you don't understand something.. )

    hi ,
    I met the same problem this morning, and searched the www.google.com in order to solve it, as a result, your article was shown on my screen. :)
    Till now I have read some technical information and solved my problems. Maybe the solution be useful to you:
    ==============================
    error message : (Environment : Tomcat 5, Windows 2003, Mysql5)
    2006-3-29 11:53:48 org.apache.catalina.core.StandardWrapper unload
    message: Waiting for 2 instance(s) to be deallocated
    ==============================
    cause: the number of connection to database exceeded.another word,too many connections.
    ==============================
    solution: close the connection when it becomes useless for your program. :)
    ==============================
    ps. Sorry for my weak English . hehe ....

  • Problem with JNI

    i have to implement a few standard APIs. As a part of the implementation I have to provide references to an object I create. Now my underlying code is C++ with JNI used to throw the Java APIs. Problem is JNI now returns different references for the same object and hence my prupose id defeated. Could anyone suggest how this problem can be overcome.

    I tried to figure out what your problem is, but can't. Please rephrase it and give a bit more detail on what you are doing and what is going wrong.

  • Problem with jni references

    i have to implement a few standard APIs. As a part of the implementation I have to provide references to an object I create. Now my underlying code is C++ with JNI used to throw the Java APIs. Problem is JNI now returns different references for the same object and hence my prupose id defeated. Could anyone suggest how this problem can be overcome.

    I'm not exactly sure what you're talking about, but it sounds like you may need to look into global references. Look at NewGlobalRef() and DeleteGlobalRef() and see if those help you out.
    God bless,
    -Toby Reyelts
    For all your JNI woes, check out Jace - http://jace.reyelts.com/jace

  • The file .docx cannot be opened because there are problems with the contents in sharepoint document library

    I created a site and  created a document libarary and assigned a word document as a content type . I have written a workflow to create a new document . The workflow is working fine and all the document is getting created and values are getting stored
    in it .
    As per my requirement I am saving the above site as site template .
    After that I am creating a new site based on the above site template , Its getting created and I started the workflow , its working fine and the document is also getting created .
    The problem is I am getting error while opening the word document
    Error - The file filename.docx cannot be opened because there are problems with the contents .
    Details - No error details availble .
    Indresh

    What are you doing within the txt document?  Is it general text and string based items, or have you something more elaborate going on?
    An older discussion here elaborates a bit more on the dotx vs docx side of things.
    http://social.msdn.microsoft.com/Forums/en-US/de1b5ff9-ea6d-460c-a707-8c28acd4906f/error-opening-office-open-xml-file-when-using-sd-workflow-to-create-item-in-document-library?forum=sharepointcustomizationlegacy
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Problems with 8.1.7 Solaris/32bits

    I tried to download the 8.1.7 for Sparc Solaris 32bits but when I called gzip it returned a message that it is not on gzip format. I downloaded again and the same message was reported by gzip. I compared the two files and no differences was encountered. Is there any problem with the image ?
    File : 817solaris.cpio.gz
    Browser : M$-Internet Explorer 5.0 on Window$ 2000
    OS : SPARC Solaris 8
    Thanks,
    Daniel Vermes

    Hans,
    It is a known problem on Windows 98, Windows and Windows 2000 if you are using Intel Pentium 4 processor with Sun JRE and Symantec JIT. I had the same problem with Windows 98. Oracle has a patch. Please see Note:131299.1 on metalink for details.

  • Problem with Snow Leopard and file sharing

    I mostly work at home where I have an 18 months-old intel iMac 24'' running Leopard and an older iMac G5 20'' (PowerPC) running Tiger. Besides, I have a three months-old MacBook Pro 17" in which I recently upgraded the system to Snow Leopard.
    Before this upgrade I never had a problem with the sharing of files between the three computers (I have them connected via Ethernet and a 5-port D-Link router wich provides flawless internet connection to the three computers). However, after the upgrade it has become impossible to connect the MacBook to the iMac G5 or vice versa via afp. Besides, getting the MacBook to connect to the (Leopard) iMac 24'' is frustratingly slow in either direction.
    A related problem is the fact that after the upgrade the portable is no longer capable of seeing directly my ethernet-connected laser printer (to one of the ports of the D-Link router) although... surprise! it does see it as a shared printer in the iMac G5 and this way it prints alright.
    Any ideas or suggestions to explore the cause of or solve this problem are warmly welcome.
    Emilio Faro

    Same problem here, did you find a solution?

Maybe you are looking for