Java native  method

I have a c function with prototype,
int __stdcall QA_Open(char *, char *, int *);If I want to call this method, what java datatypes correspond with the int ref in the argument list.
I guess the int is a pointer but i do not know what java datatype correspond with an integer pointer

This is the documentation
//Prototype
INTRET QA_Open (STRVAL vsIniFile, STRVAL vsSection,INTREF riHandle );
//Documentation
vsIniFile
Name of configuration file to open
vsSection
Section of the configuration file to use
riHandle
Instance handle returned by the API
From the documentation, I gather its expects a pointer that will be passed back each time a method in the API is called

Similar Messages

  • Java application hangs during running java native method

    Hello,
    There is compiled java application.
    It hangs at very begginings.
    It was detected that in the beggining a new Frame should be created. Then one java library invokes native method. During invoking of the native method application hangs.
    Stack is available only until native method invocation.
    Thread 25196 "main": (state = IN_NATIVE)
    at sun.awt.X11GraphicsDevice.getDoubleBufferVisuals(Native Method)
    at sun.awt.X11GraphicsDevice.getDefaultConfiguration(X11GraphicsDevice.java:181)
    at java.awt.Window.init(Window.java:271)
    at java.awt.Window.<init>(Window.java:319)
    at java.awt.Frame.<init>(Frame.java:419)
    at javax.swing.JFrame.<init>(JFrame.java:194)
    at com.test.ORBManager.Splash.<init>(Splash.java:10)
    at com.test.ORBManager.Splash.main(Splash.java:48)
    Method getDoubleBufferVisuals(int screen) is used to enumerates all visuals that support double buffering (according to comments in the source code).
    Tried to run with "-verbose" options...
    I tried to use jconsole &#1080; jvisualvm. But did not find anything special.
    Also "strace" command showed some results but do not know how to proceed:
    select(6, [5], [5], NULL, NULL) = 1 (out [5])
    writev(5, [{"b\0\6\0\r\0\0\0DOUBLE-BUFFER\0\0\0", 24}], 1) = 24
    select(6, [5], [], NULL, NULL) = 1 (in [5])
    read(5, "\1\0\t\0\0\0\0\0\1\211\0\204\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
    read(5, 0x83b57bc, 4096) = -1 EAGAIN (Resource temporarily unavailable)
    gettimeofday({1275494877, 569746}, NULL) = 0
    select(6, [5], [5], NULL, NULL) = 1 (out [5])
    writev(5, [{"b\0\6\0\r\0\0\0DOUBLE-BUFFER\0\0\0", 24}], 1) = 24
    select(6, [5], [], NULL, NULL) = 1 (in [5])
    read(5, "\1\0\n\0\0\0\0\0\1\211\0\204\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
    read(5, 0x83b57bc, 4096) = -1 EAGAIN (Resource temporarily unavailable)
    select(6, [5], [5], NULL, NULL) = 1 (out [5])
    writev(5, [{"\211\6\3\0\1\0\0\0&\0\0\0", 12}], 1) = 12
    select(6, [5], [], NULL, NULL) = 1 (in [5])
    read(5, "\1\0\v\0\f\0\0\0\1\0\0\0\377\32\0\0\377\r\307 \0\0\0\0\0\23\372\300\376\3346\34"..., 4096) = 44
    read(5, 0x83c31e4, 36) = -1 EAGAIN (Resource temporarily unavailable)
    select(6, [5], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted)
    I have downloaded from the internet the source code of native method but do not know what I can do with it.
    Is it possible to debug native method somehow?
    How to detect where the library contans the native method is located?
    What other ways can provide more information about reason.
    It seems that the problem is related to graphics. Judging by class name "X11GraphicsDevice" it is related to X server. May be some server settings?
    The problem is present on SLED 11 machines.
    It is not reproduced on SLED 10.
    I will be really appreciate for any help.
    Thanks in advance.
    Vasily.

    Hi,
    Thanks for tip. I used jstack. It gives a little bit more info but I have to few knoledges how to treat the info.
    ----------------- 24231 -----------------
    ----------------- 24317 -----------------
    0xffffe430     ????????
    0x6dd12229     ????????
    0xb0ca5898     * java.net.PlainSocketImpl.socketAccept(java.net.SocketImpl) bci:0 (Interpreted frame)
    0xb0c9fb6b     * java.net.PlainSocketImpl.accept(java.net.SocketImpl) bci:7 line:384 (Interpreted frame)
    0xb0c9fb6b     * java.net.ServerSocket.implAccept(java.net.Socket) bci:50 line:450 (Interpreted frame)
    0xb0c9fb6b     * java.net.ServerSocket.accept() bci:48 line:421 (Interpreted frame)
    0xb0c9fa94     * sun.rmi.transport.tcp.TCPTransport.run() bci:59 line:340 (Interpreted frame)
    0xb0c9fe71     * java.lang.Thread.run() bci:11 line:595 (Interpreted frame)
    0xb0c9d236     <StubRoutines>
    0xb6f38eac     _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 0x1bc
    0xb7108aa8     _ZN2os20os_exception_wrapperEPFvP9JavaValueP12methodHandleP17JavaCallArgumentsP6ThreadES1_S3_S5_S7_ + 0x18
    0xb6f38705     _ZN9JavaCalls12call_virtualEP9JavaValue11KlassHandle12symbolHandleS3_P17JavaCallArgumentsP6Thread + 0xd5
    0xb6f3879e     _ZN9JavaCalls12call_virtualEP9JavaValue6Handle11KlassHandle12symbolHandleS4_P6Thread + 0x5e
    0xb6fb0765     _Z12thread_entryP10JavaThreadP6Thread + 0xb5
    0xb71a9373     _ZN10JavaThread3runEv + 0x133
    0xb71096b8     _Z6_startP6Thread + 0x178
    0xb781a1b5     start_thread + 0xc5
    ----------------- 24318 -----------------
    0xffffe430     ????????
    0x1b7bfaf0     ????????
    ----------------- 24373 -----------------
    0xffffe430     ????????
    0xb71087be     _ZN2os5Linux14safe_cond_waitEP14pthread_cond_tP15pthread_mutex_t + 0xae
    0xb70fe2af     _ZN13ObjectMonitor4waitExiP6Thread + 0xa6f
    0xb718bdc6     _ZN18ObjectSynchronizer4waitE6HandlexP6Thread + 0x56
    0xb6f925e3     JVM_MonitorWait + 0x163
    0xb0ca5898     * java.lang.Object.wait(long) bci:0 (Interpreted frame)
    0xb0c9fb6b     * java.lang.ref.ReferenceQueue.remove(long) bci:44 line:120 (Interpreted frame)
    0xb0c9fa94     * java.lang.ref.ReferenceQueue.remove() bci:2 line:136 (Interpreted frame)
    0xb0c9fa94     * sun.java2d.Disposer.run() bci:3 line:125 (Interpreted frame)
    0xb0c9fe71     * java.lang.Thread.run() bci:11 line:595 (Interpreted frame)
    0xb0c9d236     <StubRoutines>
    0xb6f38eac     _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 0x1bc
    0xb7108aa8     _ZN2os20os_exception_wrapperEPFvP9JavaValueP12methodHandleP17JavaCallArgumentsP6ThreadES1_S3_S5_S7_ + 0x18
    0xb6f38705     _ZN9JavaCalls12call_virtualEP9JavaValue11KlassHandle12symbolHandleS3_P17JavaCallArgumentsP6Thread + 0xd5
    0xb6f3879e     _ZN9JavaCalls12call_virtualEP9JavaValue6Handle11KlassHandle12symbolHandleS4_P6Thread + 0x5e
    0xb6fb0765     _Z12thread_entryP10JavaThreadP6Thread + 0xb5
    0xb71a9373     _ZN10JavaThread3runEv + 0x133
    0xb71096b8     _Z6_startP6Thread + 0x178
    0xb781a1b5     start_thread + 0xc5
    ----------------- 24227 -----------------
    0xffffe430     ????????
    0x6cbc4021     ????????
    0x6cbc232a     ????????
    0x6cbc3c9a     ????????
    0x6cc1d5d1     ????????
    0x6d41013f     ????????
    0x6d460f19     ????????
    0xb0ca5898     * sun.awt.X11GraphicsDevice.getDoubleBufferVisuals(int) bci:0 (Interpreted frame)
    0xb0c9fb6b     * sun.awt.X11GraphicsDevice.getDefaultConfiguration() bci:140 line:181 (Interpreted frame)
    0xb0c9fa94     * java.awt.Window.init(java.awt.GraphicsConfiguration) bci:51 line:271 (Interpreted frame)
    0xb0c9fb6b     * java.awt.Window.<init>() bci:66 line:319 (Interpreted frame)
    0xb0c9fb6b     * java.awt.Frame.<init>(java.lang.String) bci:1 line:419 (Interpreted frame)
    0xb0c9fb6b     * javax.swing.JFrame.<init>(java.lang.String) bci:2 line:194 (Interpreted frame)
    0xb0c9fb6b     * com.test.ORBManager.Splash.<init>() bci:3 line:10 (Interpreted frame)
    0xb0c9fb6b     * com.test.ORBManager.Splash.<init>(java.lang.String[]) bci:4 line:48 (Interpreted frame)
    0xb0c9d236     <StubRoutines>
    0xb6f38eac     _ZN9JavaCalls11call_helperEP9JavaValueP12methodHandleP17JavaCallArgumentsP6Thread + 0x1bc
    0xb7108aa8     _ZN2os20os_exception_wrapperEPFvP9JavaValueP12methodHandleP17JavaCallArgumentsP6ThreadES1_S3_S5_S7_ + 0x18
    0xb6f38cdf     _ZN9JavaCalls4callEP9JavaValue12methodHandleP17JavaCallArgumentsP6Thread + 0x2f
    0xb6f638b2     _Z17jni_invoke_staticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP6Thread + 0x152
    0xb6f54ac2     jni_CallStaticVoidMethod + 0x122
    0x08049873     ????????
    0xb76c9705     ????????The last stack also has "sun.awt.X11GraphicsDevice.getDoubleBufferVisuals(int) bci:0 (Interpreted frame)" but what tode next?
    Also I found that the native code is in java 1.5 source code: \j2se\src\solaris\native\sun\awt\awt_GraphicsEnv.c.
    How it is possible to compile it?

  • How to use a C function as a native method

    Could anybody tell me how to use a C function as a Java native method.
    Thanks

    Read all about it.
    You'd probably have to write a little wrapper (using JNI) that passes
    parameters and return values around between your C function and
    the JVM.
    kind regards,
    Jos

  • How call native method without code modification

    "How to access third party's C API from Java Using JNI without modifying the C code"

    Unfortunately, the only way I know of doing this is to use a pass-through DLL that you write. Logically it
    looks like this:
    Java App (written by you)
    |
    v
    Java native methods (written by you)
    |
    v
    JNI DLL (written by you)
    |
    v
    3rd party DLL
    It adds a little bit of overhead, but it's not too big of a deal. Check out the JNI tutorial on how to write this.
    Bryan

  • Problems with c++ native methods

    hello to all ,
         I am building an client-server application in java , which uses java native methods written
    in c++ .In every client's request , the applcation updates a hashtable .The hashtable is kept as an
    Object member variable in a java class .So updating the hashtable is like this : the native method is
    called which accesses the Object member variable , updates the hashtable and sets the new Object
    member variable value.
         That's the way that it should work ,but i am experiencing some serious problems because the jvm
    keeps on crashing with UNEXCPECTED SIGNAL 11 .My distribution is Mandrake 9.0 ,and i use java
    j2sdk1.4.1_01
    Here some very naive questions i have to ask :
    1.Is it possible that the jvm crashes because the size of the hashtable is not fixed ?
    2.Can it be a system problem (like libgcc ) or else ?
         Any opinion on this would be very helpful
         Thanks in advance ,
              Sbile
    P.S. Here the log file being created after every crash
    Unexpected Signal : 11 occurred at PC=0x404657B6
    Function=is_forwarded__C7oopDesc+0x6
    Library=/usr/local/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
    Dynamic libraries:
    08048000-0804e000 r-xp 00000000 03:06 463913 /usr/local/j2sdk1.4.1_01/bin/java
    0804e000-0804f000 rw-p 00005000 03:06 463913 /usr/local/j2sdk1.4.1_01/bin/java
    40000000-40011000 r-xp 00000000 03:06 278533 /lib/ld-2.2.5.so
    40011000-40012000 rw-p 00010000 03:06 278533 /lib/ld-2.2.5.so
    40013000-4001c000 r-xp 00000000 03:06 119905 /usr/local/j2sdk1.4.1_01/jre/lib/i386/native_threads/libhpi.so
    4001c000-4001d000 rw-p 00008000 03:06 119905 /usr/local/j2sdk1.4.1_01/jre/lib/i386/native_threads/libhpi.so
    4001e000-40021000 r--s 00000000 03:06 447528 /usr/local/j2sdk1.4.1_01/jre/lib/ext/dnsns.jar
    40021000-40022000 r--s 00000000 03:06 198504 /usr/lib/kaffe/lib/microsoft.jar
    40022000-4002f000 r-xp 00000000 03:06 573447 /lib/i686/libpthread-0.9.so
    4002f000-40036000 rw-p 0000d000 03:06 573447 /lib/i686/libpthread-0.9.so
    40036000-40038000 r-xp 00000000 03:06 278544 /lib/libdl-2.2.5.so
    40038000-40039000 rw-p 00001000 03:06 278544 /lib/libdl-2.2.5.so
    40039000-40150000 r-xp 00000000 03:06 573443 /lib/i686/libc-2.2.5.so
    40150000-40155000 rw-p 00117000 03:06 573443 /lib/i686/libc-2.2.5.so
    40159000-40471000 r-xp 00000000 03:06 119911 /usr/local/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
    40471000-40625000 rw-p 00317000 03:06 119911 /usr/local/j2sdk1.4.1_01/jre/lib/i386/client/libjvm.so
    40635000-40646000 r-xp 00000000 03:06 278548 /lib/libnsl-2.2.5.so
    40646000-40647000 rw-p 00011000 03:06 278548 /lib/libnsl-2.2.5.so
    40649000-4066b000 r-xp 00000000 03:06 573445 /lib/i686/libm-2.2.5.so
    4066b000-4066c000 rw-p 00021000 03:06 573445 /lib/i686/libm-2.2.5.so
    4066c000-4067c000 r-xp 00000000 03:06 119915 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libverify.so
    4067c000-4067e000 rw-p 0000f000 03:06 119915 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libverify.so
    4067e000-4069f000 r-xp 00000000 03:06 119916 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libjava.so
    4069f000-406a1000 rw-p 00020000 03:06 119916 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libjava.so
    406a1000-406b6000 r-xp 00000000 03:06 119918 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libzip.so
    406b6000-406b8000 rw-p 00014000 03:06 119918 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libzip.so
    406b8000-41d86000 r--s 00000000 03:06 119961 /usr/local/j2sdk1.4.1_01/jre/lib/rt.jar
    41dc9000-41de0000 r--s 00000000 03:06 119941 /usr/local/j2sdk1.4.1_01/jre/lib/sunrsasign.jar
    41de0000-41e51000 r--s 00000000 03:06 119943 /usr/local/j2sdk1.4.1_01/jre/lib/jsse.jar
    41e51000-41e64000 r--s 00000000 03:06 119942 /usr/local/j2sdk1.4.1_01/jre/lib/jce.jar
    41e64000-42120000 r--s 00000000 03:06 119959 /usr/local/j2sdk1.4.1_01/jre/lib/charsets.jar
    441c8000-441ca000 r--s 00000000 03:06 198471 /usr/lib/kaffe/lib/comm.jar
    441ca000-441cc000 r--s 00000000 03:06 198505 /usr/lib/kaffe/lib/pjava.jar
    441cc000-441d0000 r--s 00000000 03:06 185441 /usr/local/j2sdk1.4.1_01/lib/servlet.jar
    4c3d3000-4c3fe000 r--p 00000000 03:06 212998 /usr/share/locale/ISO-8859-15/LC_CTYPE
    4c3fe000-4c40c000 r--s 00000000 03:06 447534 /usr/local/j2sdk1.4.1_01/jre/lib/ext/ldapsec.jar
    4c40d000-4c416000 r-xp 00000000 03:06 278554 /lib/libnss_files-2.2.5.so
    4c416000-4c417000 rw-p 00008000 03:06 278554 /lib/libnss_files-2.2.5.so
    4c61b000-4c638000 r--s 00000000 03:06 447527 /usr/local/j2sdk1.4.1_01/jre/lib/ext/sunjce_provider.jar
    4c638000-4c6d7000 r--s 00000000 03:06 447529 /usr/local/j2sdk1.4.1_01/jre/lib/ext/localedata.jar
    4c6d7000-4c6eb000 r--s 00000000 03:06 198506 /usr/lib/kaffe/lib/rmi.jar
    4c6eb000-4cb9e000 r--s 00000000 03:06 185437 /usr/local/j2sdk1.4.1_01/lib/tools.jar
    4cb9e000-4cc93000 r--s 00000000 03:06 198503 /usr/lib/kaffe/lib/kjc.jar
    4cc93000-4cd9e000 r--s 00000000 03:06 198507 /usr/lib/kaffe/lib/rt.jar
    4cd9e000-4cda6000 r--s 00000000 03:06 201714 /usr/lib/kaffe/lib/sax.jar
    4cda6000-4cf61000 r--s 00000000 03:06 201715 /usr/lib/kaffe/lib/xerces.jar
    4cf61000-4cf81000 r--s 00000000 03:06 201713 /usr/lib/kaffe/lib/jdom.jar
    4cf81000-4cf85000 r-xp 00000000 03:06 266660 /home/sbile/diplomatikh/build/src/lib/libBuildHashTable.so
    4cf85000-4cf86000 rw-p 00004000 03:06 266660 /home/sbile/diplomatikh/build/src/lib/libBuildHashTable.so
    4cf95000-4d03e000 r-xp 00000000 03:06 508019 /usr/lib/libstdc++.so.5.0.0
    4d03e000-4d054000 rw-p 000a8000 03:06 508019 /usr/lib/libstdc++.so.5.0.0
    4d059000-4d060000 r-xp 00000000 03:06 278604 /lib/libgcc_s-3.2.so.1
    4d060000-4d061000 rw-p 00007000 03:06 278604 /lib/libgcc_s-3.2.so.1
    4d0e2000-4d0f2000 r-xp 00000000 03:06 119921 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libnet.so
    4d0f2000-4d0f4000 rw-p 0000f000 03:06 119921 /usr/local/j2sdk1.4.1_01/jre/lib/i386/libnet.so
    Local Time = Sat May 10 04:25:40 2003
    Elapsed Time = 7
    # HotSpot Virtual Machine Error : 11
    # Error ID : 4F530E43505002E6
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
    # An error report file has been saved as hs_err_pid4063.log.
    # Please refer to the file for further information.

    The dreaded Signal 11 means you've overwritten some memory you're not supposed to.
    Check that all of your array indexes are in range, that you're not accessing memory that's been freed etc etc.
    Try placing print statements at strategic places in your native code to narrow down the problem

  • How to create new java objects in native methods?

    Hello,
    Is it possible to create java objects and return the same to the java code from a native method?
    Also is it possible to pass java objects other than String objects (for example, Vector objects) as parameters to native methods and is it possible to return such objects back to the java code?
    If so how can I access those objects (say for example, accessing Vector elements) inside the native code?
    What should I do in order to achieve them?
    Regards,
    Satish

    bschauwe is correct in that constructing Java objects and calling methods on Java objects from native code is tough and takes some study. While you're at it, you might want to check out Jace, http://jace.reyelts.com/jace. It's a free open-source toolkit that really takes the nastiness out of doing this sort of stuff. For example,/**
    * A C++ function that takes a java.util.Vector and plays around with it.
    public void useVector( java::util::Vector& vector ) {
      // Print out all the contents of the vector
      for ( Iterator it = vector.iterator(); it.hasNext(); ) {
        cout << it.next();
      // Add some new elements to the vector
      vector.addElement( "Hello" );
      vector.addElement( "world" );
    } All this code just results in calls to standard JNI functions like FindClass, NewObject, GetMethodID, NewStringUTF, CallObjectMethod, etc...
    God bless,
    -Toby Reyelts

  • A way to set a flag in java layer when native method has been called?

    Hi,
    I'm calling a native method from the java layer through to a native c function. Is there a way I can set a flag in the java layer when this native method has been called?
    Thanks!

    1. Create a wrapper method. The wrapper method is the only exposed method. It calls the native method. It sets the flag.
    2. Set the flag in the native method itself.
    3. You might be able to use the debugging API to do this however it is going to require quite a bit of work. And it injects itself at runtime.
    Is there a reason for this request? There might be other solutions if a general problem was posed.

  • Problem finding native methods in java packages

    Hi,
    I have a java class which uses some native methods written in OCamL. I wrote a C file which calls the OCamL code, and created the corresponding shared library using the jni. I then tested my java file and everything works fine, I can nicely call the OCamL functions. However, I need this java file to be included in a package, but whenever I add the line:
    package somepackage;
    on top of the java code, my java file simply doesn't seem to find the C and OCamL implementation anymore :
    javac -cp :./path/of/somepackage
    -Djava.library.path=/full/path/of/somepackage MyProgram args
    Exception in thread "main" java.lang.UnsatisfiedLinkError:functionName
    at somepackage.ClassName.functionName(NativeMethod)
    I have of course put everything (java, C, .h , libsomelibrary.so, and OCamL files) in a directory called somepackage, and written another java file which creates an instance of the first one from outside the package, imports the package, and calls its methods in main(). It just doesn't work anymore.
    I then added a simple hello-world function (not C nor OCamL code) to the java file inside the package. And when invoked from outside, it worked. Question is then... Am I forgetting something to be done, in order to get C and CamL files efectively included in the java package (same as "package somepackage;" in C or OCaml, perhaps)??? Why isn't the java file able to find them inside its very own directory (having into account that without the package definition it worked well)?
    Thanks,
    PS Im using jsdk 1.4.1 on lunyx redhat 8.0

    Did you change the name of the function in the library, too?
    If the function name was
    "Java_YourClass_functionname",
    it should be now
    "Java_path_to_your_package_YourClass_functionname".

  • Calling multiple DLL from Java and calling same native method

    i have two dll files named DLL_1.dll and DLL_2.dll .
    Both of them contain a native method which has a signature
    JNIEXPORT void JNICALL Java_Database_Notify
    (JNIEnv *, jclass);
    This method is common to both the DLL
    Now i load both of the DLL's using,
    System.loadLibrary("DLL_1");
    System.loadLibrary("DLL_2");
    Both of the DLL are loaded form same Java Application
    But the problem is that , whenever i try to call the Notify Method , it calls the Notify method of DLL_1 only.
    How do i call the Notify Methos of second DLL(i.e DLL_2).
    Is there any reference that i can get to all the DLL files when i load then , so that i can use that reference to invoke the Notify method of that particular DLL.

    i have two dll files named DLL_1.dll and DLL_2.dll .
    Both of them contain a native method which has a
    signature
    JNIEXPORT void JNICALL Java_Database_Notify
    (JNIEnv *, jclass);
    This method is common to both the DLL
    Now i load both of the DLL's using,
    System.loadLibrary("DLL_1");
    System.loadLibrary("DLL_2");
    Both of the DLL are loaded form same Java
    Application
    But the problem is that , whenever i try to call the
    Notify Method , it calls the Notify method of DLL_1
    only.
    How do i call the Notify Methos of second DLL(i.e
    DLL_2).
    Is there any reference that i can get to all the DLL
    files when i load then , so that i can use that
    reference to invoke the Notify method of that
    particular DLL.You need to explain exactly what you are trying to achieve.
    As per the description above it is impossible in java.
    And I didn't say JNI, I said java.
    Your above statement suggests that you think that you can have exactly the same java signature do two different things.
    Note again that I said java not JNI.
    A JNI method is just a tag that represents a java signature. Your description suggests that you are attempting to do it twice.
    There are three possibilities.
    1. Your explanation is incomplete.
    2. You are trying to do something that is impossible in java.
    3. You are trying to solve a problem and your description of your solution is not sufficient to determine what that is (and of course the solution is wrong.)

  • At java.lang.Throwable.fillInStackTrace(Native Method)

    Hello,
    I have a Jsp,which has a hyper link to another Jsp.Some times very rarely i get this error when i click on the
    link.
    java.lang.RuntimeException: IOException occured
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.lang.RuntimeException.<init>(Compiled Code)
    at weblogic.servlet.internal.ServletOutputStreamImpl.write(Compiled Code)
    at weblogic.servlet.internal.WLOutputStreamWriter.flushBuffer(Compiled Code)
    at weblogic.servlet.internal.WLOutputStreamWriter.write(Compiled Code)
    at weblogic.servlet.internal.WLOutputStreamWriter.write(Compiled Code)
    at java.io.Writer.write(Compiled Code)
    at weblogic.servlet.jsp.JspWriterImpl.print(Compiled Code)
    at examples.jsp._pfsonline._https._showhide.__sso_showhide_cur._jspService(Compiled Code)
    at weblogic.servlet.jsp.JspBase.service(Compiled Code)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(Compiled Code)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
    at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
    at weblogic.kernel.ExecuteThread.run(Compiled Code)
    can some one tell me when does this happen.Is it something to do with the configuration.
    Thanks
    Shashi

    Did you ever find out the answer to this question?
    I have been getting a similar error. My page draws
    fine, but I get an occasional error:
    java.lang.RuntimeException: IOException occured
    at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:178)
    at weblogic.servlet.internal.WLOutputStreamWriter.flushBuffer(WLOutputStreamWriter.java:139)
    at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:104)
    at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:111)
    at java.io.Writer.write(Unknown Source)
    at weblogic.servlet.jsp.JspWriterImpl.print(JspWriterImpl.java:155)
    at jspc._admin._offering.__offering_intro._jspService(__offering_intro.java:433)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:120)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:138)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:941)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:905)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:269)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:391)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:273)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
    Let me know if you get any answers.
    Best,
    JL
    [email protected]

  • Java.lang.OutOfMemoryError(Native Method)

    Hello Everybody,
    We hava a java.lang.OutOfMemoryError,the problem weblogic server installed in windows 2003 x64,weblogic version 9.2 MP1,sun jdk 1.5.0_22 32bit,the memory configuration below:
    set MEM_ARGS=-server -Xms1024m -Xmx1024m -verbose:gc -Xloggc:%SERVER_NAME%_GC.log -XX:SurvivorRatio=3 -XX:NewSize=512M -XX:MaxNewSize=512M -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+HeapDumpOnCtrlBreak -XX:+HeapDumpOnOutOfMemoryError
    if "%JAVA_VENDOR%"=="Sun" (
         set MEM_ARGS=%MEM_ARGS% %MEM_DEV_ARGS% -XX:MaxPermSize=512m
    The error in log below:
    ####<2013-2-16 上午11时08分15秒 CST> <Error> <Kernel> <CWGK-APP-2> <node2> <[STANDBY] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1360984095564> <BEA-000802> <ExecuteRequest failed
    java.lang.OutOfMemoryError.
    java.lang.OutOfMemoryError
         at java.io.RandomAccessFile.readBytes(Native Method)
         at java.io.RandomAccessFile.read(RandomAccessFile.java:315)
         at weblogic.diagnostics.archive.FileUtils.readFile(FileUtils.java:46)
         at weblogic.diagnostics.archive.filestore.FileIndexMetaInfo.buildIndex(FileIndexMetaInfo.java:403)
         at weblogic.diagnostics.archive.filestore.FileIndexMetaInfo.buildIndex(FileIndexMetaInfo.java:319)
         at weblogic.diagnostics.archive.filestore.FileDataArchive.computeFullIndices(FileDataArchive.java:521)
         at weblogic.diagnostics.archive.filestore.FileDataArchive.computeIndices(FileDataArchive.java:629)
         at weblogic.diagnostics.archive.filestore.FileDataIndexer$IndexCommand.run(FileDataIndexer.java:199)
         at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    >
    How can i solution the problem?
    Please help.

    Need more log information to diagnose it.
    Kinds,
    Gabriel Abelha

  • Class not found -java.security.AccessController.doPrivileged(Native Method)

    The applet was working fine around 6 months back but now the application is throwing the below exception:
    load: class DisiConnectionApplet.class not found.
    java.lang.ClassNotFoundException: DisiConnectionApplet.class
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed:http://messaging.danskenet.net/ie/NewsTicker/NewsTicker.nsf/f49a4a079e88f527c12572020033b098/$FILE/DisiConnectionApplet/class.class
         at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 7 more
    Exception: java.lang.ClassNotFoundException: DisiConnectionApplet.class
    I have checked and found the class is on proper place... I googled the issue and found that there might be any issue in IE settings... but didn't get any proper solution...
    I am using IE 6.0 with below Java plug-in :::::::::::::
    Java Plug-in 1.6.0_11
    Java(tm) Plug-in 2 SSV Helper
    Java(tm) Plug-in SSV Helper
    Web Browser Applet Control
    Please let me know what should be done on this case....????

    its exactly that... and who are you calling a fool? I think its a case of the pot calling the kettle black there mate (except you have no right to call me anything, since you are the one looking for help, and we are the ones that know)... oh and check the date... it says aug 2003... is that a month ago? come back in a month and i'll give you your answer then

  • FATAL ERROR in native method: Wrong method ID used to invoke a Java method

    When calling the same method second time , I get message ::
    <FATAL ERROR in native method: Wrong method ID used to invoke a Java method>
    void myFunction(int myVal)
    JNIEnv *env = NULL;
    jclass odbcconnls;
    jint res;
    printf("\nInitilaizing class ");
    res = (jvm)->AttachCurrentThread((void **)&env,NULL);
    if (res < 0) {
    fprintf(stderr, "Can't get Env \n");
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;          
    if(res == JNI_OK)
    printf("\nThe env is initialized ");
    if(*(&env) == NULL)
    printf(" the env is NULL ");
    printf("\nenv :::::: %s ", env);     
    // the jobject (dbc->actualConn) is a global reference
    odbcconnls = (env)->GetObjectClass(dbc->actualConn);
    if (odbcconnls == NULL) {
    goto destroy;
    switch(myVal){
    case 1:
    jmethodID methodId ;
    jboolean jbool;
    SQLINTEGER Val = (SQLINTEGER )Value;
    SQLINTEGER val1 = *Val;
    methodId = (env)->GetMethodID( odbcconnls,"myFun1","(Z)V");
    if(methodId == NULL){
    goto destroy;
    if(val1 == SQL_FALSE )
    jbool = 0;
    else
    jbool =1;
    env->CallVoidMethod(dbc->actualConn,methodId,jbool);
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId);
    jvm->DetachCurrentThread();
    return ;
    case 2 :
    jmethodID methodId1 ;
    SQLUINTEGER* Level;
    methodId1 = (env)->GetMethodID( odbcconnls,"myFun2","(I)V");
    if(methodId1 == NULL){
    goto destroy;
    Level = (SQLUINTEGER *)Value;
    env->CallVoidMethod(dbc->actualConn,methodId1,(int)*Level);
    dbc->txn_isolation = (SQLUINTEGER)Value;
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId1);
    jvm->DetachCurrentThread();
    return ;
    case 3 :
    SQLCHAR* Cate;
    jmethodID methodId2 ;
    jstring jStrCat;
    methodId2 = (env)->GetMethodID(odbcconnls,"myFun3","(Ljava/lang/String;)V");
    if(methodId2 == NULL){
    goto destroy;
    Cate = new SQLCHAR[20];
    strcpy((char *)CCatalog,(char *)Value);
    jStrCat = env->NewStringUTF((char *) Cate);
    printf("\n got jSTring ");
    env->CallVoidMethod(dbc->actualConn,methodId2,jStrCat);
    printf("\n after called method ");
    int len = strlen((char *)Cate);
    dbc->Cate = new SQLCHAR[len+1];
    strcpy((char *)dbc->Cate,(char *)Cate);
    printf("\n copied result ");
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId2);
    jvm->DetachCurrentThread();
    return ;
    destroy:
    if ((env)->ExceptionOccurred()) {
    (env)->ExceptionDescribe();
    jvm->DetachCurrentThread();
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;
    When case 1 is called second time this error is thrown..
    plz help me..
    Thanx
    MittalSunita.

    When calling the same method second time , I get
    message ::
    <FATAL ERROR in native method: Wrong method ID used
    d to invoke a Java method>
    void myFunction(int myVal)
    JNIEnv *env = NULL;
    jclass odbcconnls;
    jint res;
    printf("\nInitilaizing class ");
    res = (jvm)->AttachCurrentThread((void **)&env,NULL);
    if (res < 0) {
    fprintf(stderr, "Can't get Env \n");
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;          
    if(res == JNI_OK)
    printf("\nThe env is initialized ");
    if(*(&env) == NULL)
    printf(" the env is NULL ");
    printf("\nenv :::::: %s ", env);     
    // the jobject (dbc->actualConn) is a global
    reference
    odbcconnls = (env)->GetObjectClass(dbc->actualConn);
    if (odbcconnls == NULL) {
    goto destroy;
    switch(myVal){
    case 1:
    jmethodID methodId ;
    jboolean jbool;
    SQLINTEGER Val = (SQLINTEGER )Value;
    SQLINTEGER val1 = *Val;
    methodId = (env)->GetMethodID(
    ( odbcconnls,"myFun1","(Z)V");
    if(methodId == NULL){
    goto destroy;
    if(val1 == SQL_FALSE )
    jbool = 0;
    else
    jbool =1;
    env->CallVoidMethod(dbc->actualConn,methodId,jbool);
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId);
    jvm->DetachCurrentThread();
    return ;Why do you delete a local reference???
    Did you ever call the get local reference?
    case 2 :
    jmethodID methodId1 ;
    SQLUINTEGER* Level;
    methodId1 = (env)->GetMethodID(
    ( odbcconnls,"myFun2","(I)V");
    if(methodId1 == NULL){
    goto destroy;
    Level = (SQLUINTEGER *)Value;
    env->CallVoidMethod(dbc->actualConn,methodId1,(int)*Le
    el);
    dbc->txn_isolation = (SQLUINTEGER)Value;
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId1);
    jvm->DetachCurrentThread();
    return ;
    case 3 :
    SQLCHAR* Cate;
    jmethodID methodId2 ;
    jstring jStrCat;
    methodId2 =
    (env)->GetMethodID(odbcconnls,"myFun3","(Ljava/lang/St
    ing;)V");
    if(methodId2 == NULL){
    goto destroy;
    Cate = new SQLCHAR[20];
    strcpy((char *)CCatalog,(char *)Value);
    jStrCat = env->NewStringUTF((char *) Cate);
    printf("\n got jSTring ");
    env->CallVoidMethod(dbc->actualConn,methodId2,jStrCat)
    printf("\n after called method ");
    int len = strlen((char *)Cate);
    dbc->Cate = new SQLCHAR[len+1];
    strcpy((char *)dbc->Cate,(char *)Cate);
    printf("\n copied result ");
    env->DeleteLocalRef((jobject)res);
    env->DeleteLocalRef((jobject)odbcconnls);
    env->DeleteLocalRef((jobject)methodId2);
    jvm->DetachCurrentThread();
    return ;
    destroy:
    if ((env)->ExceptionOccurred()) {
    (env)->ExceptionDescribe();
    jvm->DetachCurrentThread();
    (jvm)->DestroyJavaVM();
    return SQL_ERROR;
    When case 1 is called second time this error is
    thrown..
    plz help me..
    Thanx
    MittalSunita.

  • Delay in executing Native Methods in Java

    Hi,
    I have the following code in my Java application.
    After calling, there is a long delay in actual execution of the native methods call. I noticed, when the program is about to terminate, then the ouput is coming from the native method.
    Here is the sample code & output of the program:
    Source :
    ======
    for (int i=0; i<5; i++) {
    System.out.println("Before : " + out);
    new SchedulerTimer().displayHelloWorld();
    System.out.println("After");
    Output:
    =====
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    After
    Hello world!
    Hello world!
    Hello world!
    Hello world!
    Hello world!
    Expected :
    ========
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    Hello world!
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    Hello world!
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    Hello world!
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    Hello world!
    After
    Before : Agent : Tue Nov 09 20:51:50 GMT+05:30 2004
    Hello world!
    After
    (In the above output, "Hello world!" is the output expected from the native method)
    (displayHelloWorld - is the native method)
    Thanks,

    Ivar's guess is probably right.
    If you use
    cout << "Hello world!\n";
    in a C++ program most probably the output will be buffered.
    Even
    cout << "Hello world!" << endl;
    is not a total guarantee for flushing the buffer, although endl promises to do that. Check your C++ documentation.

  • How can I return in a native method a Java type?

    Hi,
    i want to return in the native methode ja Java type java.awt.Dimension!
    How can I do this?
    Java code:--------------------------------------------------------------------------------
    public native java.awt.Dimension getSize()
    generating the JNI header file
    JNI header code:--------------------------------------------------------------------------------
    JNIEXPORT jobject JNICALL Java_Video_getSize(JNIEnv *, jobject)
    my c function looks like this
    code:--------------------------------------------------------------------------------
    JNIEXPORT jobject JNICALL Java_Video_getSize(JNIEnv *env, jobject obj)
    return ???????
    how can I return in C an object like jawa.awt.Dimension?
    Thx
    Ronny

    Here is my 2 cents for a way we pass data between Java and C via the Java Native Interface. This excerpt is an example of passing an int value through a locally created Integer wrapper class, which must be adapted for local use. Note that because of the wrapper, return values are not needed.
    1. Create the Java class file.
    * This class encapsulates a Java <CODE>int</CODE> primitive.
    * This class was created to allow programmers to change
    * the value of an existing integer object without being
    * forced to create a new object (as is the case with the
    * Java Integer object).
    public class LocalInteger
         private int     value;
         * Creates a LocalInteger object and initializes
         * it to <I>0</I> (the default in Java).
         public LocalInteger ()
              super ();
         * Creates a LocalInteger object and initializes
         * it using the given <I>int</I> value.
         * @param i Integer value to use in initializing
         * the object.
         public LocalInteger (int i)
              super ();
              value = i;
         * Gets the value of the object.
         * @return The value of the object.
         public int getValue ()
              return (value);
    2. Create the jni header file.
    DLL_EXTERN void jni_GetValue_from_LocalInteger(int* LocalInteger, JNIEnv *env, jobject thisLocalInteger);
    3. Create the C file.
    /*start of jni header****************************************
    *NAME/TITLE:       jni_GetValue_from_LocalInteger
    *DESCRIPTION:      This routine copies the integer value
    * from the Java LocalInteger object to the
    * C 'int' variable.
    *CALLING SEQUENCE: jni_GetValue_from_LocalInteger (LocalInteger,
    * env,
    * thisLocalInteger)
    *PARAMETERS:
    * Type Name I/O Description
    * int * LocalInteger I/O C variable
    * JNIEnv * env I JNIEnv pointer
    * jobject thisLocalInteger I Java object
    *RETURN:           N/A
    **end of header*********************************************/
    /* ********************** BEGIN CODE ********************** */
    DLL_EXPORT
    void jni_GetValue_from_LocalInteger(int* LocalInteger, JNIEnv *env, jobject thisLocalInteger)
         LocalInteger = (int) (env)->GetIntField(env, thisLocalInteger, LocalInteger_Value);

Maybe you are looking for