Hello forum,
At the moment I am developing an applet that uses a third party sdk to access a business card scanner. I have written a JNI wrapper class around this sdk so I can invoke its methods from the Java side. But I face the following problem:
At a certain point in my program the JVM exits with a crash giving me the following output ( I also left the log output of my appet in there):
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
--> 2007-11-13 14:54:50.875: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Initiating CardScan applet...
--> 2007-11-13 14:54:50.890: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Target module = Besucher_Vor
--> 2007-11-13 14:54:50.890: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Target servlet = http://10.1.10.163/visualtime/ScannerServlet
--> 2007-11-13 14:54:50.890: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Scanner type = 0
--> 2007-11-13 14:54:50.890: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Color scanning = true
--> 2007-11-13 14:54:51.093: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Loading the device wrapper class and dependent libraries.
Thread[thread applet-de.primion.cardscan.applet.CardScanApplet.class,4,file:/X:/VisualWeb/visualtime/WEB-INF/classes/-threadGroup]: library X:\VisualWeb\visualtime\src\de\primion\cardscan\dll\cardscan.dll loaded . . .
--> 2007-11-13 14:54:51.109: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Creating device wrapper instance.
--> 2007-11-13 14:54:51.125: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Found SDK-version 1.8 on client machine.
--> 2007-11-13 14:54:51.203: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Creating and starting card scanner thread.
--> 2007-11-13 14:54:51.250: applet: Thread-2: D Inactive
--> 2007-11-13 14:54:51.250: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: CardScanApplet initialization done.
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
--> 2007-11-13 14:54:51.265: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Applet start()-method called.
--> 2007-11-13 14:54:51.265: applet: thread applet-de.primion.cardscan.applet.CardScanApplet.class: D CardScanApplet: Activating scanner thread.
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
--> 2007-11-13 14:54:53.546: applet: Thread-2: D No Card.
--> 2007-11-13 14:54:55.546: applet: Thread-2: D No Card.
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
--> 2007-11-13 14:54:57.578: applet: Thread-2: D No Card.
--> 2007-11-13 14:54:59.578: applet: Thread-2: D No Card.
--> 2007-11-13 14:55:01.578: applet: Thread-2: D Card found. Scanning...
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x7904AE5
Function=[Unknown.]
Library=C:\Programme\CardScan\CAT.DLL
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at de.primion.cardscan.device.CardScanWrapper.CRTKRecognize(Native Method)
at de.primion.cardscan.device.CardScanWrapper.CRTK_Recognize(CardScanWrapper.java:246)
at de.primion.cardscan.applet.CardScannerThread.run(CardScannerThread.java:75)
Dynamic libraries:
0x00400000 - 0x0040B000 C:\Programme\java\j2sdk1.4.2_08\bin\javaw.exe
0x7C910000 - 0x7C9C7000 C:\WINDOWS\system32\ntdll.dll
0x7C800000 - 0x7C906000 C:\WINDOWS\system32\kernel32.dll
0x77DA0000 - 0x77E4A000 C:\WINDOWS\system32\ADVAPI32.dll
0x77E50000 - 0x77EE1000 C:\WINDOWS\system32\RPCRT4.dll
0x77D10000 - 0x77DA0000 C:\WINDOWS\system32\USER32.dll
0x77EF0000 - 0x77F37000 C:\WINDOWS\system32\GDI32.dll
0x77BE0000 - 0x77C38000 C:\WINDOWS\system32\MSVCRT.dll
0x76330000 - 0x7634D000 C:\WINDOWS\system32\IMM32.DLL
0x08000000 - 0x08138000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\client\jvm.dll
0x76AF0000 - 0x76B1E000 C:\WINDOWS\system32\WINMM.dll
0x10000000 - 0x10007000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\hpi.dll
0x00830000 - 0x0083E000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\verify.dll
0x00840000 - 0x00859000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\java.dll
0x00860000 - 0x0086E000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\zip.dll
0x02C60000 - 0x02D72000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\awt.dll
0x72F70000 - 0x72F96000 C:\WINDOWS\system32\WINSPOOL.DRV
0x774B0000 - 0x775ED000 C:\WINDOWS\system32\ole32.dll
0x5B0F0000 - 0x5B128000 C:\WINDOWS\system32\uxtheme.dll
0x02FD0000 - 0x03021000 C:\Programme\java\j2sdk1.4.2_08\jre\bin\fontmanager.dll
0x736D0000 - 0x73719000 C:\WINDOWS\system32\ddraw.dll
0x73B30000 - 0x73B36000 C:\WINDOWS\system32\DCIMAN32.dll
0x738B0000 - 0x73980000 C:\WINDOWS\system32\D3DIM700.DLL
0x746A0000 - 0x746EB000 C:\WINDOWS\system32\MSCTF.dll
0x75250000 - 0x7527E000 C:\WINDOWS\system32\msctfime.ime
0x770F0000 - 0x7717C000 C:\WINDOWS\system32\OLEAUT32.DLL
0x03730000 - 0x03B2F000 C:\WINDOWS\resources\Themes\Luna\Luna.msstyles
0x03220000 - 0x03229000 X:\VisualWeb\visualtime\src\de\primion\cardscan\dll\cardscan.dll
0x03B30000 - 0x03BCA000 C:\WINDOWS\system32\CSSDK32.dll
0x7C9D0000 - 0x7D1EF000 C:\WINDOWS\system32\SHELL32.dll
0x77F40000 - 0x77FB6000 C:\WINDOWS\system32\SHLWAPI.dll
0x77BD0000 - 0x77BD8000 C:\WINDOWS\system32\VERSION.dll
0x74C00000 - 0x74C2C000 C:\WINDOWS\system32\OLEACC.dll
0x76020000 - 0x76085000 C:\WINDOWS\system32\MSVCP60.dll
0x773A0000 - 0x774A3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
0x5D450000 - 0x5D4EA000 C:\WINDOWS\system32\comctl32.dll
0x76730000 - 0x76739000 C:\WINDOWS\system32\SHFOLDER.DLL
0x03C20000 - 0x03C4C000 C:\Programme\CardScan\APPINFO.DLL
0x03C60000 - 0x03C64000 C:\Programme\CardScan\Locale\de\CSSDK32dll.dat
0x03C70000 - 0x03C7A000 C:\Programme\CardScan\corexsys.dll
0x03DA0000 - 0x03DB3000 C:\Programme\CardScan\Locale\de\corexsysdll.dat
0x03DC0000 - 0x03DCA000 C:\Programme\CardScan\corexpkg.dll
0x03DE0000 - 0x03DF3000 C:\Programme\CardScan\Locale\de\corexpkgdll.dat
0x03E00000 - 0x03E5D000 C:\Programme\CardScan\System\alpha.drv
0x76350000 - 0x7639A000 C:\WINDOWS\system32\comdlg32.dll
0x73B10000 - 0x73B24000 C:\WINDOWS\system32\STI.dll
0x74A60000 - 0x74A67000 C:\WINDOWS\system32\CFGMGR32.dll
0x778F0000 - 0x779E4000 C:\WINDOWS\system32\setupapi.DLL
0x03E70000 - 0x03E75000 C:\Programme\CardScan\Locale\de\alphadrv.dat
0x76BF0000 - 0x76C1E000 C:\WINDOWS\system32\WINTRUST.dll
0x77A50000 - 0x77AE5000 C:\WINDOWS\system32\CRYPT32.dll
0x77AF0000 - 0x77B02000 C:\WINDOWS\system32\MSASN1.dll
0x76C50000 - 0x76C78000 C:\WINDOWS\system32\IMAGEHLP.dll
0x04180000 - 0x041F5000 C:\Programme\CardScan\Shared\ltkrn14n.dll
0x04200000 - 0x0424A000 C:\Programme\CardScan\Shared\ltdis14n.dll
0x04250000 - 0x0427D000 C:\Programme\CardScan\Shared\ltfil14n.dll
0x04280000 - 0x0436A000 C:\Programme\CardScan\Shared\ltimg14n.dll
0x04380000 - 0x043B8000 C:\Programme\CardScan\NPASS.DLL
0x04400000 - 0x04444000 C:\Programme\CardScan\OCR.DLL
0x04450000 - 0x0481A000 C:\Programme\CardScan\OCR\KernelAPI.dll
0x043E0000 - 0x043E9000 C:\Programme\CardScan\OCR\RecDiag.dll
0x7C340000 - 0x7C396000 C:\WINDOWS\system32\MSVCR71.dll
0x7C3A0000 - 0x7C41B000 C:\WINDOWS\system32\MSVCP71.dll
0x04820000 - 0x048E2000 C:\Programme\CardScan\OCR\CRX.dll
0x597D0000 - 0x59824000 C:\WINDOWS\system32\NETAPI32.dll
0x048F0000 - 0x04907000 C:\Programme\CardScan\OCR\AMPLM.dll
0x71A80000 - 0x71A92000 C:\WINDOWS\system32\MPR.dll
0x04920000 - 0x0493E000 C:\Programme\CardScan\OCR\LogMan.dll
0x0FFD0000 - 0x0FFF8000 C:\WINDOWS\system32\rsaenh.dll
0x77FC0000 - 0x77FD1000 C:\WINDOWS\system32\Secur32.dll
0x76620000 - 0x766D5000 C:\WINDOWS\system32\USERENV.dll
0x04A70000 - 0x04B67000 C:\Programme\CardScan\OCR\p4dll.dll
0x04B70000 - 0x04C0D000 C:\Programme\CardScan\OCR\pdread.dll
0x04C10000 - 0x04C1B000 C:\Programme\CardScan\OCR\rregexp.dll
0x04EA0000 - 0x05227000 C:\Programme\CardScan\OCR\xocr.dll
0x05230000 - 0x0526B000 C:\Programme\CardScan\OCR\pccext.dll
0x05310000 - 0x0551A000 C:\Programme\CardScan\OCR\firewrx.dll
0x05820000 - 0x0582A000 C:\Programme\CardScan\OCR\rndsdawg.dll
0x058C0000 - 0x058C8000 C:\Programme\CardScan\OCR\rndsinso.dll
0x058D0000 - 0x0590E000 C:\Programme\CardScan\OCR\ICDLLW32.DLL
0x060B0000 - 0x06157000 C:\Programme\CardScan\OCR\MOR.DLL
0x07240000 - 0x072B5000 C:\Programme\CardScan\NBC.dll
0x078E0000 - 0x0794E000 C:\Programme\CardScan\CAT.DLL
0x07960000 - 0x07994000 C:\Programme\CardScan\BayesCat.dll
0x59DD0000 - 0x59E71000 C:\WINDOWS\system32\DBGHELP.dll
0x76BB0000 - 0x76BBB000 C:\WINDOWS\system32\PSAPI.DLL
Heap at VM Abort:
Heap
def new generation total 576K, used 223K [0x10010000, 0x100b0000, 0x104f0000)
eden space 512K, 38% used [0x10010000, 0x10040d08, 0x10090000)
from space 64K, 44% used [0x10090000, 0x100971b0, 0x100a0000)
to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
tenured generation total 2276K, used 1418K [0x104f0000, 0x10729000, 0x14010000)
the space 2276K, 62% used [0x104f0000, 0x106529b0, 0x10652a00, 0x10729000)
compacting perm gen total 6912K, used 6670K [0x14010000, 0x146d0000, 0x18010000)
the space 6912K, 96% used [0x14010000, 0x14693bb8, 0x14693c00, 0x146d0000)
Local Time = Tue Nov 13 14:55:09 2007
Elapsed Time = 19
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_08-b03 interpreted mode)
#
# An error report file has been saved as hs_err_pid2172.log.
# Please refer to the file for further information.
#
What troubles me is that the Warnings
Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
are given already before my code is reached (according to the logs). The applet seems to work more stable under JDK 1.6 but also crashes sometimes. By the way I have to use 1.5.0_08 at the most. I will add my wrapper function in which the crash happens:
JNIEXPORT jint JNICALL Java_de_primion_cardscan_device_CardScanWrapper_CRTKRecognize(JNIEnv* pEnv, jobject objThis, jbyteArray p_aCallbackData)
{
jint iStatus = CRTK_ERR_BAD_HANDLE;
if( hRTK != NULL )
{
iStatus = CRTK_ERR_MEM_ALLOC_FAILED;
jbyte* aDataArray = NULL;
if( p_aCallbackData != NULL )
{
aDataArray = pEnv->GetByteArrayElements( p_aCallbackData, NULL );
}
iStatus = lpfn_CRTK_Recognize( hRTK, (LPRTKCALLBACK)progressCallback, ( VOID* )aDataArray );
if( aDataArray )
{
pEnv->ReleaseByteArrayElements( p_aCallbackData, aDataArray, 0 );
}
}
return iStatus;
}
Can anyone figure out what the problem might be? I have already tried a lot of things but I can't get over that.