JNI and huge Array

Hi,
I need to transfer nearly 120k buffer to Native C++ code and the same data back to JAVA.
I like to know how this array is transfered from Java to C++ and C++ to Java?
Can I pass the reference from Java to C++?
Thanks in advance
Raja

Do you need to use the data in java? Then you have to do the regular jni array stuff.
If you don't use it, then just have java keep a pointer - put the pointer into a java long and re-extract when you need it again.

Similar Messages

  • JNI and multidimensional arrays

    Hi
    the last days i spent searching information on how to process larger multidimensional primitive arrays ([5][300][300]) with JNI but i failed to find stringent proof for it is possible or not. Maybe somebody her can help:
    i want to pass a 3D array of ints to a c-function and do excessive manipulation there, then pass the array back. Possible? where can i find sources on that?
    Thanks for any help
    Shin

    Yes.. this is quite possible. To take your example, you would access foo[1][2][3] like this:jojbectArray middleArray = static_cast<jobjectArray>( env->GetObectArrayElement( fooArray, 1 ) );
    jintArray endArray = static_cast<jobjectArray>( env->GetObjectArrayElement( middleArray, 2 ) );
    int element = env->GetIntArrayElement( endArray, 3 );God bless,
    -Toby Reyelts
    Check out the free, open-source JNI toolkit, Jace - http://jace.reyelts.com/jace

  • JNI and multidimentional arrays

    Hi
    I'm dealing with C functions that used multidimentional arrays like tab[10][200]
    I don't know how to get them from my JAVA code using
    GetObjectArrayElement(JNIEnv *env, jobjectArray array, jsize index)
    or
    GetIntArrayRegion(JNIEnv *env, jobjectArray array, start, lenght ...)
    I seems that it is working only with one dimentional arrays ?
    Am I right ?
    Does anybody knows how to do with multidimentional ?
    Thank you !

    I'm dealing with C functions that used
    multidimentional arrays like tab[10][200]Multidimensional arrays are awkward to deal with.
    A multidimensional array in Java is an array of arrays. In effect they are like 'ragged' arrays in C, not like 'rectangular' ones. There is no way to get a 2-dimensional primitive array that contains the contents of a 2-dimensional Java array. In fact there is no way to directly access elements of a 2-dimensional Java array at all.
    In order to navigate around in a multidimensional Java array from native code, let's say you have int[10][15] and you want to get the element at [5][8]. You must use GetObjectArrayElement(env, arrayObject, 5) and this will give you the 15-element int array. Now you can use GetIntArrayRegion() or whatever to retrieve those ints. If it had been an array of objects instead of primitives then you would have to use GetObjectArrayElement on the "inner" array as well, of course.
    So your only real choice is to use a for loop. The outer for loop gets the array of primitives and then you can use GetIntArrayRegion and memcpy() etc. to copy that array into the appropriate row of your C array.
    If you had a 3-dimensional array you'd have to repeat this process because the first time through it would return a 2-dimensional array.

  • OutOfMemory??? With an huge array how I can avoid it??

    In runtime i got the OutOfMemoryError (or exception... I don't remember) when bulding an huge array... So i would like to know which dimension has usually the heap memory, if it depends from the machine you're using, and how i can avoid that error, without creating a List...
    I need the array to create a simple program for school wich will split a file in n parts, so I need to use an array of bytesn but if the file bigger than about 50mb it appears the OutOfMemory above...
    Any suggestions accepted (you'll see i'm a newbie), Thanks

    In runtime i got the OutOfMemoryError (or
    exception... I don't remember) when bulding an huge
    array... So i would like to know which dimension has
    usually the heap memory, if it depends from the
    machine you're using, and how i can avoid that error,
    without creating a List...A list is unlikely to take less room than an array.

  • Trouble with sending huge arrays via DataSocket​s.

    Hi,
    I am having trouble sending huge arrays via Data Sockets from my main vi on the server PC to the vi on the client PC.
    To further elaborate, in my main vi program I have created 3 arrays called Array1, Array2 and Array3 on my front Panel. By right clicking the mouse on each set of array and from the pop-up menu I selected Data Operations-> DataSocket Connection and I entered dstp://localhost/Array1 and clicked on Publish to broadcast the data from Array1. Similarly, I did the same for Array2 and Array3.
    Now, in my client vi program I have created three arrays on my front Panel to read (Subscribe) the data from the three arrays broadcasted via DataSockets from the server’s main vi program. To subsc
    ribe the data I did the similar process above and clicked on Subscribe to read the data (of course the IP address of the client PC will be different then the server PC so enter the hosts IP address). Once the data is received in the client arrays, I am using LV2 globals so that I can use these arrays on other sub-vi’s locally (instead of having each sub-vi get data from the server directly).
    I succeeded in doing this with two arrays, however when I added the third array the DataSockets would not work consistently. For example the refresh rate would get slower at times and sometimes 2 out of the 3 arrays would update. I don’t know if I have exceeded the limit on how much data DataSockets can broadcast, but I need to have some mechanism to broadcast 6 arrays (approx. 10000 elements for each array) of double digits precision.
    Has anyone come across this issue? Is there another way of broadcasting data more efficiently then DataSockets?
    I would appreciate any
    help that I can get.
    I have attached the files for this program in the zip file.
    First run the Server main program, testServeMainVI.vi, and then the client program, testClientMainVI.vi.
    Thanks
    Nish
    Attachments:
    beta2.zip ‏70 KB

    DataSocket can be a lossy communication. I like the advice to flatten the data to a string, but another option would be to buffer the communcation. The problem might be that the data is being overwritten on the server faster than it is being read. There is an example of buffered datasocket on NI web page: http://venus.ni.com/stage/we/niepd_web_display.DIS​PLAY_EPD4?p_guid=BA3F9DFED17F62C3E034080020E74861&​p_node=DZ52000_US&p_submitted=N&p_rank=&p_answer=&​p_source=Internal
    Also, I have played with the new built in buffered datasocket in LabVIEW 7.0. It is pretty slick. If buffers the data both on the server and the client side.

  • JVM Crash When Using JNI and COM

    I'm trying to call a DLL compiled from VB6 source code that I do not have access to. The VB6 code simply retrieves data from a DB2 database using ADO and my client code grabs that data and marshals it to my Java code. I'm attempting to achieve this using JNI and COM (without a third-party bridge). It works 75% of the time, but the other 25% of the time, the JVM crashes with the usual Hotspot crash log containing an access violation exception. However, I don't know what in my C++ code (VC++ 8) could be causing this except for passing a "wild" pointer to the code lying underneath the COM object interface. If that is the case, I don't know how I am doing that.
    The Java code that is calling my native method is running on Tomcat 5.5.25 and just to be safe, I am not allowing multiple threads to concurrently call the method in my JNI DLL (though I realize that this will kill performance). Once I can get past this problem, I'll do the COM interfacing on a worker thread in my native code so I don't screw up CoInitialize and CoUninitialize calls in the case the same thread is concurrently executing multiple calls to my native code.
    I've noticed that in most cases, the JVM crashes during my call to the pClsAccount->OpenConnection method. However, my DLL isn't what is listed on the top of the call stack, which is why I suspect the passing of a wild pointer, though I'm just taking a guess at that. Does anyone have an idea as to what's going on ?
    JNIEXPORT jobject JNICALL Java_CustomerInfo_nGetCustomerAccountInfo(JNIEnv *env, jobject customerInfo, jstring accountNumber, jstring iniFileName)
    jboolean isCopy;
    // Account info class and instance to be instantiated
    jclass accountInfoCls = NULL;
    jobject accountInfoObj = NULL;
    // The constructor ID of the accountInfoCls
    jmethodID ctorID = NULL;
    // Pointer to the interface for the ClsAccount COM object
    _clsAccount *pClsAccount = NULL;
    HRESULT hr;
    BSTR bstrIniFileName(L"");
    try
    const char *nativeAccountNumber = NULL;
    if (accountNumber != NULL)
    nativeAccountNumber = env->GetStringUTFChars(accountNumber, &isCopy);
    else
    jclass newExcCls;
    env->ExceptionDescribe();
    env->ExceptionClear();
    newExcCls = env->FindClass("java/lang/IllegalArgumentException");
    env->ThrowNew(newExcCls, "accountNumber passed in was null !");
    return NULL;
    // Initialization
    variantt varConnectionSucceeded = variantt(false);
    variantt varGetAccountInfoSucceeded = variantt(false);
    variantt varAccountNumber = variantt(nativeAccountNumber);
    bstrt bstrLastPaymentDate = bstrt();
    bstrt bstrLastErrorMessage = bstrt();
    bstrt bstrLastErrorNumber = bstrt();
    jlong jTotalDue = NULL;
    jlong jEstablishedDueDay = NULL;
    jlong jLastPaymentAmount = NULL;
    jstring jLastPaymentDate = NULL;
    jstring jLastErrorMessage = NULL;
    jstring jLastErrorNumber = NULL;
    jthrowable jException = NULL;
    const char *chLastPaymentDate = NULL;
    const char *chLastErrorMessage = NULL;
    const char *chLastErrorNumber = NULL;
    long long totalDue;
    long long lastPaymentAmount;
    long establishedDueDateDay;
    //Convert string from Java string to C string to VB string
    const char *nativeIniFileName = NULL;
    if (iniFileName != NULL)
    nativeIniFileName = env->GetStringUTFChars(iniFileName, &isCopy);
    else
    jclass newExcCls;
    env->ExceptionDescribe();
    env->ExceptionClear();
    newExcCls = env->FindClass("java/lang/IllegalArgumentException");
    env->ThrowNew(newExcCls, "iniFileName passed in was null");
    return NULL;
    bstrIniFileName = comutil::ConvertStringToBSTR(nativeIniFileName);
    CoInitialize(NULL);
    // Create an instance of the COClass with the interface over it
    hr = CoCreateInstance(__uuidof(clsAccount), NULL, CLSCTX_INPROC_SERVER, __uuidof(_clsAccount), (void **)&pClsAccount);
    if (hr == S_OK)
    varConnectionSucceeded.boolVal = pClsAccount->OpenConnection(&bstrIniFileName);
    &#12288;
    if (varConnectionSucceeded.boolVal == -1)
    varGetAccountInfoSucceeded.boolVal = pClsAccount->GetAccountPaymentInformation(&(varAccountNumber.GetVARIANT()));
    env->ReleaseStringUTFChars(accountNumber, nativeAccountNumber);
    // Extract all available account information from the ClsAccount object
    if (varGetAccountInfoSucceeded.boolVal == -1)
    totalDue = pClsAccount->TotalDue.int64;
    establishedDueDateDay = pClsAccount->EstablishedDueDateDay;
    lastPaymentAmount = pClsAccount->LastPaymentAmount.int64;
    bstrLastPaymentDate = pClsAccount->LastPaymentDate;
    chLastPaymentDate = comutil::ConvertBSTRToString(bstrLastPaymentDate.GetBSTR());
    jTotalDue = (jlong)totalDue;
    jEstablishedDueDay = (jlong)establishedDueDateDay;
    jLastPaymentAmount = (jlong)lastPaymentAmount;
    jLastPaymentDate = env->NewStringUTF(chLastPaymentDate);
    delete[] chLastPaymentDate;
    pClsAccount->CloseConnection();
    // Populate error fields if any errors occur
    bstrLastErrorMessage = pClsAccount->LastErrMessage;
    chLastErrorMessage = comutil::ConvertBSTRToString(bstrLastErrorMessage.GetBSTR());
    bstrLastErrorNumber = pClsAccount->LastErrNumber;
    chLastErrorNumber = comutil::ConvertBSTRToString(bstrLastErrorNumber.GetBSTR());
    jLastErrorMessage = env->NewStringUTF(chLastErrorMessage);
    jLastErrorNumber = env->NewStringUTF(chLastErrorNumber);
    delete[] chLastErrorMessage;
    delete[] chLastErrorNumber;
    const char* clsName = "com/nuance/merchantsmutual/businessentities/CustomerAccountInfo";
    // Find the Java class and the ID of its constructor
    accountInfoCls = env->FindClass(clsName);
    ctorID = env->GetMethodID(accountInfoCls, "<init>", "(JJJLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
    jException = env->ExceptionOccurred();
    if (jException != NULL)
    env->ExceptionDescribe();
    env->ExceptionClear();
    //Release all resources associated with the ClsAccount instance
    pClsAccount->Release();
    //Instantiate the class with the given parameters
    accountInfoObj = env->NewObject(accountInfoCls, ctorID, jTotalDue, jEstablishedDueDay, jLastPaymentAmount, jLastPaymentDate, jLastErrorMessage, jLastErrorNumber);
    jException = env->ExceptionOccurred();
    if (jException != NULL)
    env->ExceptionDescribe();
    env->ExceptionClear();
    else if (hr == REGDB_E_CLASSNOTREG)
    cout << "COM class not registered" << endl;
    else if ( hr == CLASS_E_NOAGGREGATION)
    cout << "COM class can't be aggregated" << endl;
    else if (hr == E_NOINTERFACE)
    cout << "No interface for COM class clsAccount" << endl;
    else if (hr == E_POINTER)
    cout << "*ppv pointer was NULL !" << endl;
    else
    cout << "Error occurred while creating COM object. HR is [" << hr << "]" << endl;
    // Free the BSTR because a new one was returned with a call to comutil::ConvertStringToBSTR
    SysFreeString(bstrIniFileName);
    // Release the string when it's no longer needed. MUST call if string won't be used
    // anymore or else a memory leak will occur
    env->ReleaseStringUTFChars(iniFileName, nativeIniFileName);
    CoUninitialize();
    &#12288;
    catch (_com_error &e)
    cout << "Encountered an exception in GetCustomerAccountInfo: Error was " << e.ErrorMessage();
    pClsAccount->Release();
    catch (...)
    pClsAccount->Release();
    return accountInfoObj;
    Edited by: Cthulhu76 on Jan 5, 2010 9:18 AM

    0x49202400 JavaThread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon [_thread_blocked, id=5340, stack(0x49bf0000,0x49c40000)]
    0x48a7e800 JavaThread "Thread-1" [_thread_in_native, id=5976, stack(0x48f00000,0x48f50000)]
    0x48a0dc00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3072, stack(0x48c60000,0x48cb0000)]
    0x48a09000 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4988, stack(0x48c10000,0x48c60000)]
    0x48a07c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3124, stack(0x48bc0000,0x48c10000)]
    0x48a07000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2572, stack(0x48b70000,0x48bc0000)]
    0x489f5c00 JavaThread "Finalizer" daemon [_thread_blocked, id=5752, stack(0x48b20000,0x48b70000)]
    0x489f4c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=2596, stack(0x48ad0000,0x48b20000)]
    0x003c6000 JavaThread "main" [_thread_in_native, id=4252, stack(0x00820000,0x00870000)]
    Other Threads:
    0x489f0400 VMThread [stack: 0x48a80000,0x48ad0000] [id=5624]
    0x48a18800 WatcherThread [stack: 0x48cb0000,0x48d00000] [id=1192]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 36288K, used 12762K [0x02940000, 0x050a0000, 0x07800000)
    eden space 32256K, 34% used [0x02940000, 0x0343af58, 0x048c0000)
    from space 4032K, 37% used [0x04cb0000, 0x04e2ba28, 0x050a0000)
    to space 4032K, 0% used [0x048c0000, 0x048c0000, 0x04cb0000)
    tenured generation total 483968K, used 7518K [0x07800000, 0x250a0000, 0x42940000)
    the space 483968K, 1% used [0x07800000, 0x07f57958, 0x07f57a00, 0x250a0000)
    compacting perm gen total 14080K, used 14016K [0x42940000, 0x43700000, 0x46940000)
    the space 14080K, 99% used [0x42940000, 0x436f0320, 0x436f0400, 0x43700000)
    No shared spaces configured.
    Dynamic libraries:
    0x00400000 - 0x0040f000      C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin\tomcat5.exe
    0x7c800000 - 0x7c8c0000      C:\WINDOWS\system32\ntdll.dll
    0x77e40000 - 0x77f42000      C:\WINDOWS\system32\kernel32.dll
    0x77380000 - 0x77411000      C:\WINDOWS\system32\USER32.dll
    0x77c00000 - 0x77c48000      C:\WINDOWS\system32\GDI32.dll
    0x77f50000 - 0x77feb000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77c50000 - 0x77cef000      C:\WINDOWS\system32\RPCRT4.dll
    0x76f50000 - 0x76f63000      C:\WINDOWS\system32\Secur32.dll
    0x77ba0000 - 0x77bfa000      C:\WINDOWS\system32\MSVCRT.dll
    0x7c8d0000 - 0x7d0cf000      C:\WINDOWS\system32\SHELL32.dll
    0x77da0000 - 0x77df2000      C:\WINDOWS\system32\SHLWAPI.dll
    0x76290000 - 0x762ad000      C:\WINDOWS\system32\IMM32.DLL
    0x77420000 - 0x77523000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_D8713E55\comctl32.dll
    0x6d7c0000 - 0x6da10000      C:\Program Files\Java\jre1.6.0_07\bin\client\jvm.dll
    0x76aa0000 - 0x76acd000      C:\WINDOWS\system32\WINMM.dll
    0x7c340000 - 0x7c396000      C:\WINDOWS\system32\MSVCR71.dll
    0x6d270000 - 0x6d278000      C:\Program Files\Java\jre1.6.0_07\bin\hpi.dll
    0x76b70000 - 0x76b7b000      C:\WINDOWS\system32\PSAPI.DLL
    0x6d770000 - 0x6d77c000      C:\Program Files\Java\jre1.6.0_07\bin\verify.dll
    0x6d310000 - 0x6d32f000      C:\Program Files\Java\jre1.6.0_07\bin\java.dll
    0x6d7b0000 - 0x6d7bf000      C:\Program Files\Java\jre1.6.0_07\bin\zip.dll
    0x6d570000 - 0x6d583000      C:\Program Files\Java\jre1.6.0_07\bin\net.dll
    0x71c00000 - 0x71c17000      C:\WINDOWS\system32\WS2_32.dll
    0x71bf0000 - 0x71bf8000      C:\WINDOWS\system32\WS2HELP.dll
    0x71b20000 - 0x71b61000      C:\WINDOWS\system32\mswsock.dll
    0x5f270000 - 0x5f2ca000      C:\WINDOWS\system32\hnetcfg.dll
    0x71ae0000 - 0x71ae8000      C:\WINDOWS\System32\wshtcpip.dll
    0x76ed0000 - 0x76efa000      C:\WINDOWS\system32\DNSAPI.dll
    0x76f70000 - 0x76f77000      C:\WINDOWS\System32\winrnr.dll
    0x76f10000 - 0x76f3e000      C:\WINDOWS\system32\WLDAP32.dll
    0x76f80000 - 0x76f85000      C:\WINDOWS\system32\rasadhlp.dll
    0x4a6a0000 - 0x4a6ac000      C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\CustomerInfoProxy.dll
    0x77670000 - 0x777a9000      C:\WINDOWS\system32\ole32.dll
    0x77d00000 - 0x77d8b000      C:\WINDOWS\system32\OLEAUT32.dll
    0x7c420000 - 0x7c4a7000      C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_E6967989\MSVCP80.dll
    0x78130000 - 0x781cb000      C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_E6967989\MSVCR80.dll
    0x777b0000 - 0x77833000      C:\WINDOWS\system32\CLBCatQ.DLL
    0x77010000 - 0x770d6000      C:\WINDOWS\system32\COMRes.dll
    0x77b90000 - 0x77b98000      C:\WINDOWS\system32\VERSION.dll
    0x75da0000 - 0x75e5d000      C:\WINDOWS\system32\SXS.DLL
    0x75e60000 - 0x75e87000      C:\WINDOWS\system32\apphelp.dll
    0x4dc30000 - 0x4dc5e000      C:\WINDOWS\system32\msctfime.ime
    0x4b0d0000 - 0x4b395000      C:\WINDOWS\system32\xpsp2res.dll
    0x71bb0000 - 0x71bb9000      C:\WINDOWS\system32\WSOCK32.dll
    0x4bbe0000 - 0x4bbea000      C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\ClearTranProxy.dll
    0x745e0000 - 0x7489e000      C:\WINDOWS\system32\msi.dll
    0x71c40000 - 0x71c97000      C:\WINDOWS\system32\NETAPI32.dll
    0x4bc50000 - 0x4bc6c000      C:\WINDOWS\system32\DBNETLIB.DLL
    0x71f60000 - 0x71f64000      C:\WINDOWS\system32\security.dll
    0x76c90000 - 0x76cb7000      C:\WINDOWS\system32\msv1_0.dll
    0x76cf0000 - 0x76d0a000      C:\WINDOWS\system32\iphlpapi.dll
    0x761b0000 - 0x76243000      C:\WINDOWS\system32\crypt32.dll
    0x76190000 - 0x761a2000      C:\WINDOWS\system32\MSASN1.dll
    0x4bcf0000 - 0x4bcff000      C:\Program Files\Common Files\System\Ole DB\SQLOLEDB.RLL
    0x4a8a0000 - 0x4a8aa000      C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\MIGI.DLL
    0x73570000 - 0x736c2000      C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib\MSVBVM60.DLL
    0x4a950000 - 0x4a9e2000      C:\Program Files\Common Files\System\ado\msado15.dll
    0x74a50000 - 0x74a6a000      C:\WINDOWS\system32\MSDART.DLL
    0x4c850000 - 0x4c8c9000      C:\Program Files\Common Files\System\Ole DB\oledb32.dll
    0x4dbb0000 - 0x4dbc1000      C:\Program Files\Common Files\System\Ole DB\OLEDB32R.DLL
    VM Arguments:
    jvm_args: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 5.5 -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 5.5 -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\endorsed -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 5.5\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\logging.properties -Djava.library.path=C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MMI\WEB-INF\lib vfprintf -Xms512m -Xmx1024m
    java_command: <unknown>
    Launcher Type: generic
    Environment Variables:
    JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07
    [error occurred during error reporting (printing environment variables), id 0xc0000005]
    --------------- S Y S T E M ---------------
    OS: Windows Server 2003 family Build 3790 Service Pack 2
    CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 7 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3
    Memory: 4k page, physical 2097151k(2097151k free), swap 4194303k(4194303k free)
    vm_info: Java HotSpot(TM) Client VM (10.0-b23) for windows-x86 JRE (1.6.0_07-b06), built on Jun 10 2008 01:14:11 by "java_re" with MS VC++ 7.1
    time: Mon Dec 28 15:24:00 2009
    elapsed time: 600 seconds

  • Java 1.5 JNI and C++ exception

    Hello, All
    I've troubles with handling C++ exceptions using JNI and shared library. I'm using Java 1.5_06, RedHat 7.3 and JBoss 4.0.5
    From Java class I call JNI a method in my shared library(libx.so) which calls a method in other shared library(liby.so). Liby.so uses Xerces library. During parsing process an exception occurs. But according to Xerces sources it's a normal behavior and should be caught. But instead I've got SIGNABRT in JVM and a core dump will created. What's wrong? Backtrace shows similar something:
    XXXXX  __default_terminate() ....
    XXXXX  __terminate() ....
    XXXXX  __throws
    XXXXX C++ method ..
    XXXXX.....
    XXXXX.....
    XXXXX  JNI methodI found similar bugs reports in the forum. But they says about Java 1.4 version and according to bugs descriptions it should be already fixed.
    Message was edited by:
    kostik78

    The question is closed. The root cause was incorrect building of shared library.

  • Trying to learn Structure and/or Array

    OK here goes my best attempt at an explanation... I been
    through some tutorial on Structures and Arrays and have an ok idea
    of what to do with them. But all the tutorials I went through had
    the variable amounts hard coded in, but I want it to come from a
    database query(s).
    I want to get a mileage total per month per riderId
    tablename: mileageLog
    table fields: ridierId, rideDate, rideDistance
    First I want to query a DB and get all the riderId numbers
    (grouped so I only have one for each). This is no problem.
    <cfquery name="riderIds" datasource="DevKevin">
    SELECT riderId
    FROM mileageLog
    GROUP BY riderId
    </cfquery>
    Now using each riderId, I want to put the results into a
    structure and/or array so that I can then turn around and sort as
    desired.
    I think I need to use a loop - one for each riderId.
    Inside each loop, I would need a second loop running 12 times
    (once for each month)
    The inner loop would run a query like...
    <cfquery name="mileageByMonth" datasource="DevKevin">
    SELECT sum(rideDistance) AS monthTotal
    FROM mileageLog
    WHERE riderId=
    ???? from above somehow
    AND year(rideDate)=#nowYear#
    AND month(rideDate)=#
    ???? loop through 12 months#
    </cfquery>
    I'm so lost

    quote:
    Originally posted by:
    2onboard
    This does indeed return the correct amounts - THANKS
    But how do I utilize them? by that I want to take my results
    and put it into a table that is 14 columns wide.
    Column 1 = the riderID
    Columns 2-13 = the monthly totals
    column 14 = a yearly total
    I also want to be able to sort by any column
    Now it becomes complicated. I'm going to assume that you want
    the current year, not the last 12 months. That means you don't
    necessarily want 14 columns. I also assume that Access's month()
    function returns a number like 4, and not a string like April. I
    don't use Access so I don't actually know.
    Step 1 - Use query of queries and valuelist to get a list of
    distinct month numbers. I'll call this variable abc.
    Step 2 - Build another list of the month names for each of
    those numbers. The function is MonthAsString. I'll call this
    variable months. Then build a third list, the same length, with the
    word integer as each element. I'll call this variable xyz.
    Step 3 - Create a new query. This will have your data in a
    cross tab format for later.
    xTab = QueryNew("Rider,#months#,total",
    "varchar,#xyz#,integer");
    Step 4 - Loop through your original query and use if/else
    logic to populate the xTab query.
    Final Step - Use a flash grid to display your xTab query.
    That will enable you to sort on any column.

  • JNI and Out of Memory errors

    Hi,
    At my job, we seem to have a memory leak related to JNI. We know we
    have a memory leak because we keep getting Out of Memory errors even
    after increasing the maximum heap size to more than 256 megs. And we
    know that this is the application that is eating up all the system
    memory.
    We are running under Windows 2000, with both JDK 1.3.0 and JDK 1.4.1.
    We tried looking at the problem under JProbe, but it shows a stable
    Java heap (no problems, except that the Windows task manager shows it
    growing and growing...)
    I tried a strip down version, where I set the max heap size to 1 Meg,
    and print out the total memory, memory used, and maximum memory used at
    a 5 sec interval.
    Memory used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory().
    Well, I let that strip down version running for about a day. The
    maximum memory used has stabilized to about 1.1 Meg, and has not
    increased. The current memory used increases until it gets to some
    threshold, then it decreases again. However, the Windows task manager
    shows the memory increasing -- and currently it is at 245 Megs!
    In the lab, the behavior we see with the Windows task manager is as
    follows:
    1. Total memory used in the system increases until some threshold.
    2. Then it goes back down by about 100 Megs.
    3. This cycle continues, but at each cycle the memory goes back down
    less and less, until the app crashes.
    Now, our theory is that JNI is consuming all this memory (maybe we are
    using JNI wrong). That's the only explanation we can come up with to
    explain what we have seen (Java showing an OK heap, but the task
    manager showing it growing, until crashing).
    Does that make sense? Can the new operator throw an Out of Memory
    error if the system does not have enough memory to give it, even if
    there is still free heap space as far as the Runtime object is
    concerned? Does the Runtime object figures objects allocated through
    JNI methods into the heap used space?
    Note that I know the task manager is not a reliable indicator.
    However, I don't think a Java app is supposed to runaway with system
    memory -- the problem is not simply that the Java app is consuming too
    much memory, but that it seems to always want more memory. Besides, we
    do get the Out of Memory error.
    Thanks for your help,
    Nicolas Rivera

    Hi,
    there are two sources of memory leakage in JNI:
    - regular leaks in c/c++ code;
    - not released local/global references of java objects in JNI.
    I think that the first issue in not a problem for you. The second is more complex. In your JNI code you should check
    - how many local references alive you keep in your code as their number is restricted (about 16 and can be enlarged). The good style is not to store local references but keep only global.
    - any local reference accepted from java call in JNI are released by JVM. You should release local references you created in JNI and also global references.
    - do not use a large number of java object references. Each new reference gets new memory in JVM. Try to reuse refences.
    I guess that is your problem.
    Vitally

  • Paper clip in Mavericks mail bitmapped and huge!

    Attachment icon in the viewer message window now bit mapped and huge under Mavericks. Rebooted, quit and reopened Mail. Problem always there. Looks ugly that's all. No problems so far anywhere else.

    I have the same problem, resizing doesn't seem to do it and the window size keeps messing it up.  LEt me know when there's a fix for this.  Make you second guess "FREE" upgrades.

  • PhotoShop CS5 Extended serial number - NOT accepted - is there a quick fix? Many thanks and hugs for the winning answer :-)

    guys, i need you help - CLEARLY - so I bought PhotoShop CS5 Extended two years ago - but never real used it - today I requested the serial number - which was sent asap - BUT the system doesn't accept it, says it invalid - question - am I doing doing something wrong or is there a quick fix? Many thanks and hugs for the winning answer :-) Somayeh!

    Unfortunately, only Adobe customer service can assist you with your issue. These are user forums; you are not addressing Adobe here.
    Click on the link below, and after that click on "Still need Help? Contact us."
    Then on the next page, click Chat
    There is also a phone option.
    http://helpx.adobe.com/contact.html?step=PHXS_downloading-installing-setting-up_licensing- activation

  • Slow sync and huge synservices.log file

    If you get slow sync and huge ~/Library/Logs/Sync/syncservices.log file, check that iSync is log logging everything it can.
    In terminal, type :
    defaults read -g SyncServicesLogEverything
    if it returns YES, then here is your probem, just turn it off or delete this default :
    defaults delete -g SyncServicesLogEverything

    Can you specify the versions of the iPhone OS, Windows XP and iTunes??

  • How can i combine an array of string and an array of integers ?

    i have an array of string data [to be used as header], and an array of multiple column integer vakues;i need them together in one file. 
    Am not able to combine them so that i can write them into a single file.
    Solved!
    Go to Solution.
    Attachments:
    string file input.txt ‏1 KB
    Test build_1.vi ‏13 KB

    There are a few ways you can do this.  What I recommend is:
    Open the file
    Use the Array to Spreadsheet String to turn your headers into a single string
    Write this to the file.
    Use the Array to Spreadsheet String to turn your numeric data into a single string
    Write this to the file.
    Close the file
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How do I wrap and int array?

    Hello,
    this is my first time using the Java forum so I hope it can be helpful :)
    Im having a problem with my computer assignment at school. Here is the code im having trouble with
    private void writeObject (ObjectOutputStream out) throws IOException
         out.defaultWriteObject (); // do the default stuff
         out.writeObject (strokeColor);
         out.writeObject(xList);
         out.writeObject(yList);
         private void readObject (ObjectInputStream in) throws IOException,    ClassNotFoundException
         in.defaultReadObject (); // do the default stuff
         strokeColor = (Color) in.readObject ();
         xList = (Integer[]) in.readObject();
         yList =  (Integer[]) in.readObject();
         }In the readObject method, Im trying to restore the values of the arrays xList and yList by wrapping the data back to and integer array, but I keep getting an incompatible types error. Any suggestions?

    never mind, I just used some ArrayList objects instead and that solved the problem

  • Diffrence mailbox GUID and CAS array

    What's the diffrence between Mailbox GUID and CAS Array & What's the benefit for GUID.

    Hi,
    Mailbox GUID is the property of Exchange mailbox and we can think of the mailbox GUID as the primary key for the mailbox. It is a unique value that distinguishes an individual mailbox from all others. Regardless of which Active Directory user account owns
    the mailbox, the mailbox GUID always remains the same as long as the mailbox exists.
    CAS array is an object. It includes all CAS servers in one site and is used for high availability.
    As you know, different from previous Exchange server, all Outlook clients in Exchange 2013 uses Autodiscover to create a new connection point comprised of mailbox GUID, @ symbol, and the domain portion of the user’s primary SMTP address. This is because
    that the simple change results in a near elimination of the unwelcome message of “Your administrator has made a change to your mailbox. Please restart.”
    Thanks,
    Angela Shi
    TechNet Community Support

Maybe you are looking for

  • Firefox auto-update bounces back end forth between 3.6.11 and 3.6.12

    Firefox keeps going through the following apparently endless cycle: It realizes it's not on the latest version and auto-updates from 3.6.11 to 3.6.12. Everything is fine for a few uses, then it tells me it needs to reboot to complete an update, upon

  • Script that worked in CS does not work in CS4 - multiple open page, print , pdf export and close

    I had a script that worked great for me in Indesign CS. But now does not work in CS4. Anyone knows what needs to be done to make it work again ? When I drop folder with indesign files on top of this script: 1. opens first page 2. turns specific layer

  • Need to Create Customer Master Data under Multiple Sales Areas

    Hi Gurus,          My requirement is to create a customer under multiple sales areas by processing the Inbound Idoc function module "IDOC_INPUT_DEBITOR"( After generating Outbound Idoc and outbound is processed successfully).          But, when I am

  • XML validation using XDK DOM/SAX Parser

    Hello, I am trying to validate xml against xsd using SAX/DOM parser, both the files are stored as CLOB column in the database. I have the requirement to report all the validation errors and based on some helpful advice/code from the earlier posts in

  • Upgrade internal hard drive on MacBook Pro (1,1)

    Can I upgrade my 15" MacBook Pro (1,1)2.16ghz Intel Core Duo to the 200GB(7200rpm) or 250 (5400rpm) internal hard drive? Is there a significant difference in the speed between the two. Does Apple sell them? Or are they third party? Thanks for any hel