NullPointer in invoking JNI function

Hi everybody.
I have small problem. I'm trying to call dll (jnidll) function (f1) from java that calls function (f2) in another dll (that is not jni - actually is 3rd party so I cannot change it).
I have no problem calling function f1 from my java application, and I have no problem calling function f2 from another C++ test application. But I have problem calling f1 that calls f2.
I get NullPointerException to my java application.
Does anybody have an idea how to solve it?
I tried also to use jawin.dll for calling that non-jni dll but had the same (NullPointer) problem.

Ok, first I wanted only quick answer, if anybody had the same problem. Now I will post my code here, because I didn't solved the problem yet.
Let's suppose that the name of the jni dll I'm trying to create is myjnidll.dll. It's header file has jni.h included and e.g. two following lines:
JNIEXPORT jint JNICALL Java_JniPosApi00_MbtConnect (JNIEnv *, jobject, jstring);
JNIEXPORT jint JNICALL Java_JniPosApi00_MbtDisconnect (JNIEnv *, jobject);Source file of my dll has following definitions of that functions. Name of called 3rd party dll is 3rdparty.dll and it has functions Connect and Disconnect exported with the following names _Connect@4 and _Disconnect@0.
#include <windows.h>
#include <jni.h>
#include "myjnidll.h"
typedef long (__stdcall *INTxVOID)();
typedef long (__stdcall *INTxSTR)(LPCTSTR);
JNIEXPORT jint JNICALL Java_JniPosApi00_mConnect
  (JNIEnv * jEnv, jobject jObj, jstring jszSubSystem) {
    LPCTSTR szSubSystem = jEnv->GetStringUTFChars(jszSubSystem, 0);
    long result = 1;
    INTxSTR ProcAdd;
    HINSTANCE hinstLib = LoadLibrary("3rdparty.dll");
    if (hinstLib != NULL) {
        ProcAdd = (INTxSTR) GetProcAddress(hinstLib, "_Connect@4");
        if (ProcAdd != NULL)
            res = (ProcAdd)("SUBSYSTEM1");
    jEnv->ReleaseStringUTFChars(jszSubSystem, szSubSystem);
    FreeLibrary(hinstLib);
    return res;
JNIEXPORT jint JNICALL Java_JniPosApi00_mDisconnect
  (JNIEnv * jEnv, jobject jObj) {
    long res = 1;
    INTxVOID ProcAdd;
    HINSTANCE hinstLib =  = LoadLibrary("3rdparty.dll");
    if (hinstLib != NULL) {
        ProcAdd = (INTxVOID) GetProcAddress(hinstLib, "_Disconnect@0");
        if (ProcAdd != NULL)
            res = (ProcAdd)();
    FreeLibrary(hinstLib);
    return res;
}I'm sure, that the 3rdparty.dll library is in the system path.
Parameters of functions in 3rd party dll are (from the description that I have):
Connect(UCHAR FAR*)
Disconnect(void)Both functions return int. I think there will be no problem with parameters.
My java program that is calling myjnidll is
public class MyJavaCallingJniDll {
    public native int mConnect (String szSubSystem);
    public native int mDisconnect ();
    static {
        System.loadLibrary("myjnidll");
    public MyJavaCallingJniDll() {
    public int myConnect (String szSubSystem) {
        return mConnect (szSubSystem);
    public int myDisconnect (){
        return mDisconnect ();
}and I'm calling this from another java class, but there is no problem for sure.
So I did som tests and the result is, that when calling from java I get NullPointerException when I'm trying to call mConnect() (or mDisconnect()).
When I try to call from C++ I get "Unhandled exception, blabla Access violation" at the line where I'm trying to invoke functions from 3rd party dll.
I have no idea, where's the problem. Thanks anybody, who's trying to help me.

Similar Messages

  • Invoking  Remote Function Module.

    Hi
    I am invoking a remote function module from a web dynpro application(External Appln ).
    The FM contains the following code snippet
    first it inserts the parameters passed into a table
    and then the code is
    SUBMIT <report name > with parameter passing.
    when i comment out the Submit statement and invoke the function module the parameters get populated in the table..but when i enable the SUBMIT statement the same set of parameters dont even get populated in the table. and i get the following exception in the logs of SAP J2ee appln server .
    WDDynamicRFCExecuteException:      Screen output without connection to user.                           , error key: RFC_ERROR_SYSTEM_FAILURE
    i am not able to find a solution to this problem .
    Please help.
    regards
    Nilesh Taunk.

    HI
    GOOD
    GO THROUGH THIS LINKS,THEY MIGHT HELP YOU TO GIVE YOU SOME MORE IDEA.
    Re: RFC Error While Invoking A Remote Function Module.
    RFC Error While Invoking A Remote Function Module.
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5303c390-0201-0010-e0b2-bfae018377f0
    THANKS
    MRUTYUN

  • How to invoke a function with arguments in JSTL expressions

    Hi ,
    I want to know how to send arguments in the JSTL expression.
    I have a scenario like this
    for (int i=0; i<nicList.size(); i++)
                          NavigationItemControl nic = nicList.get(i);
                          ni = nic.getNavigationItem();
                          //scr
                          if (nic.isAvailable(Mask.SYSTEM))
                          { %>
                            <option value="<%=ni.getInternalHandle()%>"  <% if(pi.getNavigationItemHandle().equals(ni.getInternalHandle())) {%>selected<%}%> ><%=nic.getLabel()%></option>
                          <%
                        }   I was changed these code into JSTL ,the new one is
    <c:forEach var="nic" items="${nicList}">                                             
                                                 <c:set var="ni" value="${nic.navigationItem}"/>
                                                 <c:set var="nicAvailableMaskSystem" value="${*nic.available*}"/>
                                                 <c:set var="navigationItemHandle" value="true" />                                             
                                                      <c:if test="${nicAvailableMaskSystem}">
                                                           <option <c:if test="${pi.navigationItemHandle==ni.internalHandle}">  selected </c:if> value="${ni.internalHandle}" >
                                                                     ${nic.label}
                                                           </option>
                                                      </c:if>
                                            </c:forEach>in the above code I have problem with nic.isAvailable(Mask.SYSTEM),
    Can any one help me on this how can I invoke a function in JSTL with arguments.
    -Bhaskar

    JSTL can only handle getter/setter methods. You can't pass parameters to the methods.
    There are a couple of ways around this
    1 - set up "mask" as a seperate attribute of the NavigationItemControl bean.
    ie getMask() setMask()
    and then have your isAvailable method as
      public boolean isAvailable(){
        return internalIsAvailable(getMask());
      }Another solution is to define a static function and invoke it as a function.
    public static boolean navigationAvailable(NavigationItemControl, Mask);
    What does the isAvailable() method do? How complicated is it?
    Hope this helps,
    evnafets

  • Can i invoke a function of a compiled script from java?

    Hi,
    Can i invoke a function of a 'CompiledScript' from java with parameters?
    TIA

    sabre150 wrote:
    I don't know about anyone else but I don't understand what you are trying to do.<Goldie mode>
    Bwahahaha, you are one of the oligarchs here and yet you don't know what Compiled Scripts are? Even Chaucer wrote about them, which the Queen of England told me when we shared a kebab in my working-class pals' kebab shop.
    </Goldie mode>

  • At Craig's suggestion: Why Invoke PERL functionality from WD-ABAP?

    Craig -
    This is response to your suggestion that I post my own reasons for thinking that it would be useful to be able to invoke PERL functionality from WD-ABAP.
    Please note at the outset that these reasons are based on my own personal belief that the relatively new vertical sectors of bioinformatics/biomed could produce reasonably significant income for SAP in a reasonably short time if SAP decided to create application-level functionalities in these areas. 
    This belief is in turn based on a very significant new initiative which has been publicly announced by the university Medical Center recently voted "most-wired" (Vanderbilt) and equivalent initiatives at other university Medical Centers across the country.  (BTW, I've posted a meeting time (Tue 7pm) at Tech Ed for anyone who wants to learn more about these initiatives, the new vertical sectors they define, and how SAP could EASILY play in them.)
    So, with this background established, assume that SAP does decide to play in the bioinformatic/biomed sector. 
    SAP will rapidly find that a lot of biomed is based on the kind of bioinformatics that essentially does pattern-analysis on two kinds of strings: polynucleotide strings (DNA, mRNA, tRNA, etc.) and polypeptide strings (mainly the amino acid strings that form the "primary structures" of protiens.)  For example, biomed will soon include the ID of "at risk" markers for all patients in a university medical center, indicating what diseases patients may be genetically at risk for due to SNP's and other abnormalities in their inherited DNA.
    Now when such analysis is not done by running "canned" versions of well-developed programs such as the ubiqitious BLAST program for "aligning" polynucleotide or polypeptide sequences, it is done by programs written in languages that offer superb capabilities for pattern-searching and manipulation of strings, e.g. PERL.
    Additionally, I know from personal experience and the experience of my SigOther that even data obtained from well-known canned programs must be further massaged by non-canned techniques that again are readily implementable in PERL and other similar languages.
    Finally, a lot of bioinformatic/biomed applications require iterative batch execution of canned stat routines such as t-tests or normality tests, which can be conveniently done via calls from languages such as PERL to canned products such as STATA.
    So assume SAP wants to develop a biomed application that has:
    back-end data containing the usual kinds of info med centers need to know about patients, plus the new kinds of scientific info about patients that med centers are creating
    a presentation component that displays these two kinds of data for query, further elaboration/refinement, and subsquent update.
    For example, there will be times when a doctor will want to take scientific data on a patient from the back-end (e.g. portions of a patient's DNA), subject it to pattern-analysis of the type described above, and then store the results of the analysis as additional new scientific info in the back-end databases.
    And SAP can readily provide the doctor with this capability if it allows PERL functionality to be invoked from WD/WD-ABAP components.  In some cases, the PERL will simply invoke industry-standard canned programs such as BLAST and wrap the results in a way friendly to SAP.  In other cases, the PERL may do the analysis itself.  In other cases, the PERL may invoke stat programs.  Etc, etc. etc.
    The point is that there is a vast inventory of bioinformatic/biomed PERL code out there, and if SAP wants to get serious about playing in the bioinformatics/biomed sector, it will be much easier to talk to this inventory of programs rather than recreate it in JAVA or SAP inside SAP. 
    Anyway, please remember - this post was based on the  assumption that SAP may want to get serious about playing in the bioinformatic/biomed sector.
    If not, then as Rosanne Rosanadanna used to say, "Never mind".

    Hi David,
    Where it can be used :-
    Anywhere that you can insert ABAP code to run, you can integrate Perl in the manor that I laid out.  The only requirements are the ability to run registered RFC programs, and to execute ABAP code including RFC calls (which is anywhere inside of an R/3 system basically).
    Comparison with other techniques :-
    All communication from the ABAP stack with the J2EE stack is done via RFC - this is only faster than a registerd RFC Server if Fast RFC is used which means that the J2EE stack MUST reside on the same host as the R/3 instance.  Therefore there is no performance difference at that level and any performance differentiation is going to be in the programming language Perl vs Java, or payload encoding techniques (XML) at that level (not withstanding the consideration of development time).
    There is also the HTTP Client communication facilities - with or without document encodings (the ICF + eg. SOAP).  Again - I'd take a long hard look at whether it is necessary to be encumbered with the data packet encoding/ecapsulation overhead.
    What you gain :-
    Once you are in the "land of Perl" you have access to essentially any module you can find on CPAN, so any data access you require whether it be some kind of application server technology, or DB, can be fullfilled by whats available there (unless you need to roll your own?).  And lets not forget algorythm implemented in Perl or Perl XS extensions - probably very important in the medical/scientifc field.
    SOA (IMO) is a big ugly 4 letter word.  At the end of the day, you have to look where your time and money is best spent, and whether you can achieve the desired results using Scripting Language Connector technology, or whether you feel compelled to go down a WS-* style route.
    However - I would like to say this - IMO it is totally unecessary to wrap up system integration in multiple (expensive both in money, and performance considerations) layers if you are confident that you have good control over both ends of the communication streams.  I believe that when your main objective is to utilise large chunks of code written in another language (rather than reimplement it in something closer to SAPs core interests), or communicate with inhouse data sources/systems (I've done this for MySQL before), then this is definitely one such case that opens the door for using my outlined approach (in the article).
    Cheers,
    Piers Harding.
    Message was edited by: Piers Harding

  • JNI function name length exceeds linker support size?

    hi,
    JNI function names are Java_Package_classname_functionname. But i have a package+classname itself crossing 32 characters. i need to have more than one native function in the same class. so linker cannot distinguish these names. any workarounds?
    thanx in advance

    Hi,
    I don't know of any way around JNI's name mangling rules, but pardon me for asking, the linker of what platform supports symbols with length <= 32 only these days?
    Kind Regards,
    Tobias

  • How to invoke math functions from dbx?

    Is there an easy way to invoke math functions from dbx? If I try, for example, to call sqrt I get meaningless results:
    (dbx) print sqrt(4.0)
    sqrt(4) = 1074790400
    (dbx)
    This is from code which uses sqrt, so sqrt should be accessible. Does this need some kind of cast?

    It turns out that this is a bit different than it looks: dbx is indeed able to invoke functions invoked in this way correctly; dbx just fails to print a sensible return value.
    I tried with the following small function:
    #include <stdio.h>
    int printme(double x) {
    printf("This is %g\n",x);
    return (int)2*x;
    Compiling this without -g, linking this with some hello world program and invoking the function from dbx gives
    (dbx) print ((int (*)(double))printme)(4.0)
    This is 4
    ((int (*)(double)) printme)(4) = &(noname)(double) at 0x8
    (dbx)
    The line "This is 4" clearly indicates that the function has been invoked correctly. Just the printed return value is meaningless. In this case, it is even possible to construct expressions with the return value:
    (dbx) print 5 + ((int (*)(double))printme)(4.0)
    This is 4
    5+((int (*)(double)) printme)(4) = 13
    i.e. dbx "knows" the correct return value 8. This does, however, apparently not work with return values of type double (i.e. in the original sqrt-Example).
    I have therefore submitted a bug report with bugs.sun.com; I will post the BugID when (and if) this has been accepted.

  • How to get bytes[] using jni functions

    I am new to JNI and have a question. I have a java class which returns back bytes[]
    I have the class jclass for the object and the jmethodid bytesMethodID which is mapped like this:
    bytesMethodID = (*env)->GetMethodID(env, objcls, "bytes", "()[B");
    now in the c impementation I have a stuct pointer
    DESIGN_STRUCT *str= NULL;
    How do I assign the bytes[] into this struct pointer? If I do the following:
    str = (*env)->CallObjectMethod(env, obj, bytesMethod());
    I get a "assignment from incompatible pointer type" if I change that to:
    str = (*env)->CallBytesMethod(env, obj, bytesMethod());]
    I get a "assignment makes pointer from integer without a cast"
    My question is what JNI function do i use to get back a byte[]
    Any help and pointers greatly appreciated.
    Thanks,

    You should use CallObjectMethod() and cast the return value to a jbyteArray. Then you need to use a function like GetByteArrayElements() to actually retrieve the individual elements in that array.
    God bless,
    -Toby Reyelts
    Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace.

  • Function Invoking Another Function

    Trying to invoke 1 function from another function, using same parameters for each.
    Trying to invoke 1 function from another function. MasterFunction has parameterX which is a dictionary Name. When attempting to call ChildFunction from within MasterFunction, and passing it the same parameter that MasterFunction has, got javascript error 'Invalid Object'.
    Here is basic scenario:
    MasterFunction(dictionaryName)
    ChildFunction(dictionaryName);
    Both of these functions are in the JavaScript function list.
    Any help on this would be appreciated.

    You need to pass the dictionary object, not the dictionary name.  So you would pass in a parameter of "serviceForm.DictName", which is the dictionary object.  Then, if your parameter name was "objDict", you would call methods against it, for example: "objDict.setVisible(false);" and "objDict.FieldName.getValue();"
    If, for some reason, you do need or want to pass a string of the dictionary name, you need to use the "eval" method to get the dictionary object back: eval("serviceForm." + dictString + ".FieldName.getValue()");

  • Invoking winapi functions

    hi all can i call winapi functions in form 9i as it can be in VB. If yes can any one give me at least one example , suppose i want to shutdown my pc.
    thanks

    Hi,
    Maybe this example cut will work for you. It passes and gets
    string:
    Statement stmt = conn.createStatement ();
    CallableStatement cs = conn.prepareCall ("begin ? :=
    MyFunction(?); end;");
    cs.registerOutParameter(1,Types.CHAR);
    cs.executeUpdate();
    System.out.println (cs.getString(1).trim());
    Robertas
    Sudhir Kulkarni (guest) wrote:
    : How to call Stored Functions from Oracle.. Does JDBC allow
    this
    : to do..
    : Callable Statement allows only Stored Procedures.
    : Does It allow to invoke Database Functions..
    : Pl. Explain is there any other way to invoke Database
    Functions..
    : Thanks in Advance,
    : Sudhir Kulkarni
    null

  • Any limitations regarding number of JNI functions used?

    Are there any limitations regarding the number of JNI functions used?
    Is there any performance\footprint\other issue when using over 500 JNI functions?
    Thanks you
    Noa.

    I'm new to the JNI world. The JNI world is no different from any other programming world in the respects you're asking about.
    is the number of native functions in my JNI interface may have any affect on the performance?Same answer. Why would it? Why are you fixated on the number of functions here and there? It's about the last thing you should be concerned with. Bizarre question. What you should be worried about is time and space.
    Does the general performance of the JVM and specifically the access time to each of the functions may differ in the case of having 1 JNI function verse having 1000 such functions?Why would it?
    (for example due to going over a long lookup table etc). Do you actually think the designers of JNI are that incompetent? Why?

  • Invoke RFC function without input parameters

    Is it possible to invoke RFC function that doesn't have input parameters? It returns all data from reference.

    Hi Denis,
    pls keep in mind that no reference parameter is allowed in RFC, you have to check that "Pass Value" flag.
    Thanks
    Luis

  • I get EXCEPTION_ACCESS_VIOLATION by calling JNI function.

    Hello Everyone.
    I need someone's help that I have a problem with JNI.
    I got an error as below when a Java program calls JNI function that I created with VC++.
    JNI functions are called not once and got an error not first call.
    First of all, The JNI function is called at Main function.
    then, Main function create another thread.
    and next JNI function is called in another thread.
    when the JNI function is called first time is suceeded.
    but, second time is always failed.
    I wrote down some of detail in source code's comment.
    // ErrorLog is from here ------------------------------------------------------
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d7c7c5f, pid=2460, tid=3144
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode)
    # Problematic frame:
    # V [jvm.dll+0x87c5f]
    --------------- T H R E A D ---------------
    Current thread (0x00843650): JavaThread "Thread-0" [_thread_in_vm, id=3144]
    siginfo: ExceptionCode=0xc0000005, reading address 0x00000009
    Registers:
    EAX=0x00000001, EBX=0x06d77d40, ECX=0x00000008, EDX=0x00843710
    ESP=0x0afaf4a8, EBP=0x0afaf4d8, ESI=0x0afaf4ec, EDI=0x0afaf53c
    EIP=0x6d7c7c5f, EFLAGS=0x00010246
    Top of Stack: (sp=0x0afaf4a8)
    0x0afaf4a8: 0afaf4ec 06d77d40 6d7cfa7e 00000001
    0x0afaf4b8: 0afaf53c 0afaf4ec 06d77d40 00843070
    0x0afaf4c8: 00841a10 00841a18 00841e04 00843650
    0x0afaf4d8: 0afaf53c 100020a6 00843710 0082f3d0
    0x0afaf4e8: 0afaf5a0 0afaf5a4 06d77d40 06d77d40
    0x0afaf4f8: cccccccc cccccccc cccccccc cccccccc
    0x0afaf508: cccccccc cccccccc cccccccc cccccccc
    0x0afaf518: cccccccc cccccccc cccccccc cccccccc
    Instructions: (pc=0x6d7c7c5f)
    0x6d7c7c4f: 5f 5e 5b c3 8b 44 24 04 8b 0d 14 e2 8b 6d 53 56
    0x6d7c7c5f: 8b 34 01 8b 0d 10 e2 8b 6d 57 8b 3c 01 8b 0d 0c
    Stack: [0x0af70000,0x0afb0000), sp=0x0afaf4a8, free space=253k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V [jvm.dll+0x87c5f]
    C [FilterDriver.dll+0x20a6]
    C [FilterDriver.dll+0x16c7]
    C [FilterDriver.dll+0x1c59]
    C [FilterDriver.dll+0x22b3]
    j xx.xx.xx.xx.xx.TestClass.get(Ljava/lang/String;)Z+0
    j xx.xx.xx.xx.xx.ClassExtendedThread.run()V+24
    v ~StubRoutines::call_stub
    V [jvm.dll+0x875dd]
    V [jvm.dll+0xdfd96]
    V [jvm.dll+0x874ae]
    V [jvm.dll+0x8720b]
    V [jvm.dll+0xa2089]
    V [jvm.dll+0x1112e8]
    V [jvm.dll+0x1112b6]
    C [MSVCRT.dll+0x2a3b0]
    C [kernel32.dll+0xb683]
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j xx.xx.xx.xx.xx.TestClass.get(Ljava/lang/String;)Z+0
    j xx.xx.xx.xx.xx.ClassExtendedThread.run()V+24
    v ~StubRoutines::call_stub
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x008433b0 JavaThread "DestroyJavaVM" [_thread_blocked, id=2676]
    =>0x00843650 JavaThread "Thread-0" [_thread_in_vm, id=3144]
    0x0083d5f0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2024]
    0x0083c730 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3444]
    0x0083b560 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2784]
    0x00839970 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=2876]
    0x00838c60 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2980]
    0x00836250 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=536]
    0x0082e410 JavaThread "Finalizer" daemon [_thread_blocked, id=2100]
    0x0082d190 JavaThread "Reference Handler" daemon [_thread_blocked, id=1968]
    Other Threads:
    0x0082c470 VMThread [id=296]
    0x0083fd50 WatcherThread [id=464]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 576K, used 300K [0x02bd0000, 0x02c70000, 0x030b0000)
    eden space 512K, 58% used [0x02bd0000, 0x02c1b200, 0x02c50000)
    from space 64K, 0% used [0x02c50000, 0x02c50000, 0x02c60000)
    to space 64K, 0% used [0x02c60000, 0x02c60000, 0x02c70000)
    tenured generation total 1408K, used 0K [0x030b0000, 0x03210000, 0x06bd0000)
    the space 1408K, 0% used [0x030b0000, 0x030b0000, 0x030b0200, 0x03210000)
    compacting perm gen total 8192K, used 1711K [0x06bd0000, 0x073d0000, 0x0abd0000)
    the space 8192K, 20% used [0x06bd0000, 0x06d7bf00, 0x06d7c000, 0x073d0000)
    No shared spaces configured.
    Dynamic libraries:
    0x00400000 - 0x0040d000      C:\Program Files\Java\jdk1.5.0_14\bin\javaw.exe
    0x7c940000 - 0x7c9dd000      C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c932000      C:\WINDOWS\system32\kernel32.dll
    0x77d80000 - 0x77e29000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77e30000 - 0x77ec1000      C:\WINDOWS\system32\RPCRT4.dll
    0x77cf0000 - 0x77d7f000      C:\WINDOWS\system32\USER32.dll
    0x77ed0000 - 0x77f17000      C:\WINDOWS\system32\GDI32.dll
    0x77bc0000 - 0x77c18000      C:\WINDOWS\system32\MSVCRT.dll
    0x762e0000 - 0x762fd000      C:\WINDOWS\system32\IMM32.DLL
    0x60740000 - 0x60749000      C:\WINDOWS\system32\LPK.DLL
    0x73f80000 - 0x73feb000      C:\WINDOWS\system32\USP10.dll
    0x6d740000 - 0x6d8de000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\client\jvm.dll
    0x76af0000 - 0x76b1b000      C:\WINDOWS\system32\WINMM.dll
    0x6d300000 - 0x6d308000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\hpi.dll
    0x76ba0000 - 0x76bab000      C:\WINDOWS\system32\PSAPI.DLL
    0x6d400000 - 0x6d435000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\jdwp.dll
    0x6d710000 - 0x6d71c000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\verify.dll
    0x6d380000 - 0x6d39d000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\java.dll
    0x6d730000 - 0x6d73f000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\zip.dll
    0x6d290000 - 0x6d297000      C:\Program Files\Java\jdk1.5.0_14\jre\bin\dt_socket.dll
    0x719e0000 - 0x719f7000      C:\WINDOWS\system32\WS2_32.dll
    0x719d0000 - 0x719d8000      C:\WINDOWS\system32\WS2HELP.dll
    0x71980000 - 0x719bf000      C:\WINDOWS\System32\mswsock.dll
    0x76ed0000 - 0x76ef7000      C:\WINDOWS\system32\DNSAPI.dll
    0x76f60000 - 0x76f68000      C:\WINDOWS\System32\winrnr.dll
    0x76f10000 - 0x76f3c000      C:\WINDOWS\system32\WLDAP32.dll
    0x76f70000 - 0x76f76000      C:\WINDOWS\system32\rasadhlp.dll
    0x607c0000 - 0x60816000      C:\WINDOWS\system32\hnetcfg.dll
    0x719c0000 - 0x719c8000      C:\WINDOWS\System32\wshtcpip.dll
    0x10000000 - 0x10076000      C:\xx\whaticreated.dll
    0x71a50000 - 0x71a62000      C:\WINDOWS\system32\MPR.dll
    VM Arguments:
    jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:1759
    java_command: xx.xx.xx.xx.xx.Sample start
    Launcher Type: SUN_STANDARD
    Environment Variables:
    JAVA_HOME=C:\Program Files\Java\jdk1.5.0_14
    PATH=C:\WINDOWS\system32;C:\WINDOWS;D:\tools\apache-ant-1.7.0\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;D:\PROGRA~1\ATT\Graphviz\bin;D:\Program Files\doxygen\bin;D:\Program Files\Microsoft SDK\Bin\.;D:\Program Files\Microsoft SDK\Bin\WinNT\.;C:\Program Files\Java\jdk1.5.0_14\bin;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;D:\Program Files\Microsoft SDK\Bin\.;D:\Program Files\Microsoft SDK\Bin\WinNT\.
    USERNAME=xxx
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 2, GenuineIntel
    --------------- S Y S T E M ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 2 (cores per cpu 2, threads per core 1) family 6 model 15 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 1038124k(270512k free), swap 1711740k(953716k free)
    vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0
    // The end of ErrorLog --------------------------------------------------------
    and the codes are below.
    // TestClass.java
    public class TestClass {
         // Load native library
         static{
              System.loadLibrary("DLLName");
         public native int start(String str, int count);
         public native int end();
         public native boolean get(String str);
    // ClassExtendedThread.java
    public class ClassExtendedThread extends Thread {
         private TestClass tc;
         // Constructor
         public ClassExtendedThread(TestClass in_tc)
              ts = in_tc;
         // This will be executing in another thread
         public void run()
              while( true )
                   if( !false )
                        String str = new String();
                        // get function returns false means nothing to catch event.
                        if( false == ts.get( str ) ) // calling first time is suceed. but, I got an error second time.
                          // Set Interval for loop.
    // Sample.java
    public class Sample {
         public static void main(String[] args) {
              TestClass tc = null;
              ClassExtendedThread cet = null;
              tc = new TestClass();
              // Init something
              if(0 != TestClass.start(xxx, xxx)) // First JNI function suceeds.
                   System.out.println("start error.");
                   return;
              // Starting Thread
              cet = new ClassExtendedThread(tc);
              cet.start();
    }Have anyone got any idea to resolve this problem?
    Edited by: fc3srx7m on Apr 25, 2008 3:56 AM

    Hi Martin.
    Thank you for your advice.
    I thought the problem is in the FilterDriver.dll as well.
    I tried DebugBreak() into native code.
    but, I still can't find where the problem is.
    I'm trying to convert C structure to Java class like using structConverter which is tool of book for JNI.
    Here's some code including native code.
    // Java source codes //////////////////////////////////////////////////////////////////////////////////
    // Event.java ----------------------------------------------------------------------------------------------
    // This class for C structure Convert
    public class Event {
         private int     aaa;
         private long     bbb;
         private String     ccc;
            // Getter/Setter
         public int getAaa() {
              return aaa;
         public void setAaa(int aa) {
              aaa = aa;
         public long getBbb() {
              return bbb;
         public void setBbb(long cc) {
              bbb = bb;
         public String getCcc() {
              return ccc;
         public void setCcc(String cc) {
              ccc = cc;
            // Field Initialize
         private native static void initFIDs();
         static {
              initFIDs();
    // EventStruct,java --------------------------------------------------------------------------------------
    public class EventStruct extends Event {
         private void _init()
              setAaa(0);
              setBbb(0);
              setCcc(new String());
         // Constructor
         public LogEventStruct()
              _init();
              System.loadLibrary("FilterDriver");
    // EndOfJavaSource ////////////////////////////////////////////////////////////////////////////////////
    // Native source code /////////////////////////////////////////////////////////////////////////////////
    // Event.cpp ----------------------------------------------------------------------------------------------
    // FieldIDs
    static jfieldID Event_Aaa_FID;
    static jfieldID     Event_Bbb_FID;
    static jfieldID     Event_Ccc_FID;
    // Initialize Adapter
    static void initEventFieldIDs(JNIEnv* env, jclass clazz)
              Event_Aaa_FID     = env->GetFieldID(clazz, "aaa",     "I");
              Event_Bbb_FID     = env->GetFieldID(clazz, "bbb",      "J");
              Event_SFlNm_FID = env->GetFieldID(clazz, "ccc",      "Ljava/lang/String;");
    // Call from Java
    JNIEXPORT void JNICALL Java_Event_initFIDs(JNIEnv *env, jclass clazz)
              initEventFieldIDs(env, clazz);
    // Setter
    void jni_SetAaa_in_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisaaa)
              env->SetIntField(thisaaa, Event_Aaa_FID, (jint)__EVENT_->aaa);
    // Getter
    void jni_GetAaa_from_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisaaa)
              __EVENT_->aaa = (int)env->GetIntField(thisaaa, Event_Aaa_FID);
    // Setter
    void jni_SetBbb_in_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisbbb)
              env->SetLongField(thisbbb, Event_Bbb_FID, __EVENT_->bbb);
    // Getter
    void jni_GetBbb_from_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisbbb)
              __EVENT_->bbb = (unsigned int)env->GetLongField(thisbbb, Event_Bbb_FID);
    // Setter
    void jni_SetCcc_in_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisccc)
              env->SetObjectField(thisccc, Event_Ccc_FID, env->NewStringUTF(__EVENT_->ccc));
    // Getter
    void jni_GetCcc_from_Event(EVENT* __EVENT_, JNIEnv *env, jobject thisccc)
              jboolean isCopy;
              const char *str = __EVENT_->ccc;
              jstring jstr = (jstring)env->GetObjectField(thisccc, Event_Ccc_FID);
              str = env->GetStringUTFChars(jstr, &isCopy);
              if(JNI_TRUE == isCopy)
                        env->ReleaseStringUTFChars(jstr, str);
    // Getting (Java Object to C Structure)
    void jni_SetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent)
              jni_SetAaa_in_Event(__EVENT_, env, thisEvent);
              jni_SetBbb_in_Event(__EVENT_, env, thisEvent);
              jni_SetCcc_in_Event(__EVENT_, env, thisEvent);
    // Setting (C structure to Java Object)
    void jni_GetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent)
              jni_GetAaa_from_Event(__EVENT_, env, thisEvent);
              jni_GetBbb_from_Event(__EVENT_, env, thisEvent);
              jni_GetCcc_from_Event(__EVENT_, env, thisEvent);
    // AnotherLib.h ------------------------------------------------------------------------------------
    // C Structure which I want to convert.
    typedef struct EVT {
         int                  aaa;
         unsigned int    bbb;
         char               ccc[256];
    } EVENT;
    // prototype
    BOOL GetEvent( EVENT* buf, char *name );
    // test.h -----------------------------------------------------------------------------------------------------
    #if !defined(AFX_TEST_H__F9A4A432_24D3_4DE4_89D7_A2009B8EC2AA__INCLUDED_)
    #define AFX_TEST_H__F9A4A432_24D3_4DE4_89D7_A2009B8EC2AA__INCLUDED_
    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    #include <windows.h>
    #include "AnotherLib.h"
    #include "Event.h" // output by javah command
    extern void jni_GetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent);
    extern void jni_SetAll_in_Event(EVENT *__EVENT_, JNIEnv *env, jobject thisEvent);
    #endif // !defined(AFX_TEST_H__F9A4A432_24D3_4DE4_89D7_A2009B8EC2AA__INCLUDED_)
    // test.cpp --------------------------------------------------------------------------------------------------
    JNIEXPORT jboolean JNICALL Java_get(JNIEnv *env, jobject obj, jstring name)
              EVENT s_Event;
              char strName[_MAX_PATH];
    //DebugBreak();
              memset(&s_Event, 0x00, sizeof(EVENT));
              memset(strName, 0x00, _MAX_PATH);
              jni_SetAll_in_Event(&s_Event, env, obj);
              BOOL ret = GetEvent(&s_Event, strName);
              if(TRUE == ret)
                        jni_GetAll_in_Event(&s_Event, env, obj);
                        // convert char array to jstring
                        name = env->NewStringUTF(strName);
              return ret;
    // EndOfNativeSource ////////////////////////////////////////////////////////////////////////////////Edited by: fc3srx7m on Apr 27, 2008 10:05 PM

  • Returning values from JNI functions to Java

    I have a JNI function which returns a "jstring" to the calling Java function.
    I need also to return 2 byte values.
    Can I return them all...? if so, how?

    I have a JNI function which returns a "jstring" to the
    calling Java function.
    I need also to return 2 byte values.
    Can I return them all...? if so, how?"Also"? Then you do the same thing as if you were returning two different types in java only code, you wrap it in an object.

  • How to invoke RFC function module from XI interface

    Hi all,
    I am having one question, How to invoke RFC function module from XI interface.
    Please reply me as soon as possible.
    Thanks in advance,
    Radhika

    Hi,
    To call the RFC in mapping u need to create the RFC lookups...check these links.
    How we have to create the lookups?
    Check this weblogs with some screenshots on how to achieve this:
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    lookups in xi
    XI Design Guidelines
    Re: RFC Lookup API
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    Regards,
    Phani

Maybe you are looking for

  • Help on Materialized view

    Hi all , I need some help on materialized view. I have to make a MV in dbms_dtm schema I have 2 tables like below sales and orduct salescolumns: salesid,prodid,subid,charges and product columns: subid and billid sales.subid = product.subid. i need a

  • Reinstalling Edge Animate trial version on another device

    My old PC crashed after I installed a trial version of Edge Animate. I tried to reinstall on my laptop, but when I tried to access the download page, I get a blank screen.

  • Transferring iDVD 4 project to iDVD5

    We saved an iDVD 4 project but the original iMovie folder was deleted. When we went to burn on iDVD it kept on freezing. We therefore transferred it to the Mini Macs via a lacie hard drive. When we went to burn the project on iDVD5 a message appeared

  • Consuming an XML Service

    I want my Flash program to use LoadVars to get data from an XML service every 60 seconds...or some relative timeout value. What does LoadVars support in terms of an event that can handle such a callback? I have AJAX code that updates the webpage ever

  • Task Shceduler Items

    Really I run Windows 7 64-Bit that came with laptop (Home?). I would like to know if it's ok to disable the following Items in Task Scheduler? AD RMS Rights Policy Template Management (Manual): "Updates the AD RMS rights policy templates for the user