执行任何IO / Streams时,C ++ JNI崩溃/挂起(C++ JNI crashes/hangs when doing any IO/Streams)
在尝试编译要在JAVA端使用的C ++代码时,我似乎遇到了一个大问题。 当我尝试做任何IO / Stream / Manipulation相关的事情时,JVM似乎崩溃了。
有时,就像我运行应用程序时每10次一样,JNI 100%使用所有IO内容。 然后其余时间JVM崩溃或挂起。
我正在使用: Windows 10 x64,JAVA jdk1.8.0_102,Netbeans 8.1,g ++,附加选项:-D__int64 = int64_t
当我这样做时,JNI工作正常:
JNIEXPORT jstring JNICALL Java_Main_nativePrint (JNIEnv *env, jobject) { return env->NewStringUTF("HELLO"); } JNIEXPORT jstring JNICALL Java_Main_nativePrint (JNIEnv *env, jobject) { double var = std::sqrt(100); return env->NewStringUTF("HELLO"); }
当我尝试合并诸如
printf
,std::stringstream
,sprintf
,cout
或puts
,JVM崩溃了。 甚至实例化std::stringstream
似乎让我崩溃了。 我假设其他类型的操作函数也让我崩溃:Java_Main_nativePrint(JNIEnv *env, jobject instance) { int variable = 100; char str[15]; //CRASHES ON HERE sprintf(str, "%d", variable); //CRASHES ON HERE IF ABOVE COMMENTED OUT OR USING ANOTHER CHAR ARRAY. puts(str); //CRASHES ON HERE return env->NewStringUTF(str); } JNIEXPORT jstring JNICALL Java_Main_nativePrint (JNIEnv *env, jobject) { double res = std::sqrt(100); //CRASHES HERE ON INSTANTATION OF stringstream std::stringstream ss; //ss << std::sqrt(100); //const char* str = ss.str().c_str(); return env->NewStringUTF("HELLO"); }
我似乎对这个人有类似的问题:
带有c ++的JNI不断崩溃cout,printf和方法调用
这是我的转储:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180117a37, pid=6064, tid=0x0000000000002e40 # # JRE version: Java(TM) SE Runtime Environment (8.0_102-b14) (build 1.8.0_102-b14) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [cygwin1.dll+0xd7a37] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x0000000002e70800): JavaThread "main" [_thread_in_native, id=11840, stack(0x0000000002d70000,0x0000000002e70000)] siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000000 Registers: RAX=0x0000000000000000, RBX=0x0000000002e6f328, RCX=0x00000003fec8bfe0, RDX=0x00000003fec5ee60 RSP=0x0000000002e6f100, RBP=0x0000000000000018, RSI=0x0000000002e6f258, RDI=0x0000000002f7835d R8 =0x0000000002e6f298, R9 =0x0000000002d67610, R10=0x0000000002e70000, R11=0x00000003fec5ee08 R12=0x0000000000000000, R13=0x000000001bf903f0, R14=0x0000000002e6f420, R15=0x0000000002e70800 RIP=0x0000000180117a37, EFLAGS=0x0000000000010202 Top of Stack: (sp=0x0000000002e6f100) 0x0000000002e6f100: 00000001800f0390 0000000180117a4b 0x0000000002e6f110: 0000000002d6eee0 0000000002d6eee8 0x0000000002e6f120: 0000000002e70800 000000005b94a34e 0x0000000002e6f130: 0000000002e6f328 00000003fec62d16 0x0000000002e6f140: 000000005bd50088 0000005000000000 0x0000000002e6f150: 0000000000000015 0000000000000000 0x0000000002e6f160: 0000000002e6f1f0 0000000002e6f258 0x0000000002e6f170: 0000000002f7835d 00000003fec58d59 0x0000000002e6f180: 0000000000000000 0000000000000100 0x0000000002e6f190: 0000000000000002 0000000002d6ebf0 0x0000000002e6f1a0: 0000000002e70800 000000001bf903f0 0x0000000002e6f1b0: 0000000020200021 0000000002f7835d 0x0000000002e6f1c0: 0000000002e6f250 00000005c9f710e4 0x0000000002e6f1d0: 0000000000000010 0000000000000008 0x0000000002e6f1e0: 0000000002e70800 0000000002f93b63 0x0000000002e6f1f0: 000000001bf903f0 0000000002e70800 Instructions: (pc=0x0000000180117a37) 0x0000000180117a17: 04 f3 90 eb e3 48 c7 c0 08 00 00 00 49 0f c1 82 0x0000000180117a27: 50 e4 ff ff 4c 8d 1d 19 00 00 00 4c 87 5c 24 08 0x0000000180117a37: 4c 89 18 41 ff 82 44 e4 ff ff 41 ff 8a 4c e4 ff 0x0000000180117a47: ff 58 ff e0 65 4c 8b 14 25 08 00 00 00 41 bb 01 Register to memory mapping: RAX=0x0000000000000000 is an unknown value RBX=0x0000000002e6f328 is pointing into the stack for thread: 0x0000000002e70800 RCX=0x00000003fec8bfe0 is an unknown value RDX=0x00000003fec5ee60 is an unknown value RSP=0x0000000002e6f100 is pointing into the stack for thread: 0x0000000002e70800 RBP=0x0000000000000018 is an unknown value RSI=0x0000000002e6f258 is pointing into the stack for thread: 0x0000000002e70800 RDI=0x0000000002f7835d is at code_begin+2301 in an Interpreter codelet invoke return entry points [0x0000000002f77a60, 0x0000000002f78440] 2528 bytes R8 =0x0000000002e6f298 is pointing into the stack for thread: 0x0000000002e70800 R9 =0x0000000002d67610 is an unknown value R10=0x0000000002e70000 is pointing into the stack for thread: 0x0000000002e70800 R11=0x00000003fec5ee08 is an unknown value R12=0x0000000000000000 is an unknown value R13={method} {0x000000001bf903f8} 'nativePrint' '()Ljava/lang/String;' in 'Main' R14=0x0000000002e6f420 is pointing into the stack for thread: 0x0000000002e70800 R15=0x0000000002e70800 is a thread Stack: [0x0000000002d70000,0x0000000002e70000], sp=0x0000000002e6f100, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [cygwin1.dll+0xd7a37] C [cygwin1.dll+0xb038f] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j Main.nativePrint()Ljava/lang/String;+0 j Main.main([Ljava/lang/String;)V+18 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x000000001dea8800 JavaThread "Service Thread" daemon [_thread_blocked, id=3408, stack(0x000000001e280000,0x000000001e380000)] 0x000000001c538800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=5372, stack(0x000000001dd80000,0x000000001de80000)] 0x000000001c535800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5400, stack(0x000000001dc80000,0x000000001dd80000)] 0x000000001c531000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=5124, stack(0x000000001db80000,0x000000001dc80000)] 0x000000001c52f000 JavaThread "Attach Listener" daemon [_thread_blocked, id=2432, stack(0x000000001da80000,0x000000001db80000)] 0x000000001c52e000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=336, stack(0x000000001d980000,0x000000001da80000)] 0x0000000002f6a800 JavaThread "Finalizer" daemon [_thread_blocked, id=11892, stack(0x000000001d7a0000,0x000000001d8a0000)] 0x0000000002f61000 JavaThread "Reference Handler" daemon [_thread_blocked, id=11932, stack(0x000000001d6a0000,0x000000001d7a0000)] =>0x0000000002e70800 JavaThread "main" [_thread_in_native, id=11840, stack(0x0000000002d70000,0x0000000002e70000)] Other Threads: 0x000000001c4f8000 VMThread [stack: 0x000000001d5a0000,0x000000001d6a0000] [id=13280] 0x000000001ded3000 WatcherThread [stack: 0x000000001e380000,0x000000001e480000] [id=11656] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap: PSYoungGen total 76288K, used 2621K [0x000000076b500000, 0x0000000770a00000, 0x00000007c0000000) eden space 65536K, 4% used [0x000000076b500000,0x000000076b78f5e8,0x000000076f500000) from space 10752K, 0% used [0x000000076ff80000,0x000000076ff80000,0x0000000770a00000) to space 10752K, 0% used [0x000000076f500000,0x000000076f500000,0x000000076ff80000) ParOldGen total 175104K, used 0K [0x00000006c1e00000, 0x00000006cc900000, 0x000000076b500000) object space 175104K, 0% used [0x00000006c1e00000,0x00000006c1e00000,0x00000006cc900000) Metaspace used 2586K, capacity 4486K, committed 4864K, reserved 1056768K class space used 282K, capacity 386K, committed 512K, reserved 1048576K Card table byte_map: [0x0000000012330000,0x0000000012b30000] byte_map_base: 0x000000000ed21000 Marking Bits: (ParMarkBitMap*) 0x000000005bf8a6c0 Begin Bits: [0x0000000013480000, 0x0000000017408000) End Bits: [0x0000000017408000, 0x000000001b390000) Polling page: 0x0000000002c00000 CodeCache: size=245760Kb used=1102Kb max_used=1105Kb free=244657Kb bounds [0x0000000002f70000, 0x00000000031e0000, 0x0000000011f70000] total_blobs=254 nmethods=23 adapters=145 compilation: enabled Compilation events (10 events): Event: 0.060 Thread 0x000000001c538800 18 s 3 java.lang.StringBuffer::append (13 bytes) Event: 0.060 Thread 0x000000001c535800 20 4 java.lang.String::charAt (29 bytes) Event: 0.060 Thread 0x000000001c538800 nmethod 18 0x0000000003080210 code [0x00000000030803c0, 0x0000000003080af8] Event: 0.060 Thread 0x000000001c538800 21 3 java.lang.AbstractStringBuilder::append (50 bytes) Event: 0.061 Thread 0x000000001c538800 nmethod 21 0x0000000003080ed0 code [0x00000000030810a0, 0x00000000030817f8] Event: 0.061 Thread 0x000000001c538800 22 3 java.lang.String::indexOf (7 bytes) Event: 0.061 Thread 0x000000001c535800 nmethod 20 0x00000000030847d0 code [0x0000000003084920, 0x00000000030849f8] Event: 0.061 Thread 0x000000001c538800 nmethod 22 0x00000000030843d0 code [0x0000000003084540, 0x0000000003084748] Event: 0.064 Thread 0x000000001c538800 23 3 java.util.Arrays::copyOfRange (63 bytes) Event: 0.064 Thread 0x000000001c538800 nmethod 23 0x0000000003082950 code [0x0000000003082b60, 0x0000000003083698] GC Heap History (0 events): No events Deoptimization events (0 events): No events Internal exceptions (2 events): Event: 0.025 Thread 0x0000000002e70800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x000000076b507c78) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u102\7268\hotspot\s�4�B��? Event: 0.025 Thread 0x0000000002e70800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x000000076b507f60) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u102\7268\hotspot\src\share\vm\prims\ Events (10 events): Event: 0.063 loading class java/security/UnresolvedPermission Event: 0.063 loading class java/security/UnresolvedPermission done Event: 0.064 loading class java/security/BasicPermissionCollection Event: 0.064 loading class java/security/BasicPermissionCollection done Event: 0.064 loading class sun/launcher/LauncherHelper$FXHelper Event: 0.064 loading class sun/launcher/LauncherHelper$FXHelper done Event: 0.064 loading class java/lang/Class$MethodArray Event: 0.064 loading class java/lang/Class$MethodArray done Event: 0.064 loading class java/lang/Void Event: 0.064 loading class java/lang/Void done Dynamic libraries: 0x00007ff77e020000 - 0x00007ff77e057000 C:\Program Files\Java\jdk1.8.0_102\bin\java.exe 0x00007ffb13b20000 - 0x00007ffb13ce1000 C:\Windows\SYSTEM32\ntdll.dll 0x00007ffb13110000 - 0x00007ffb131bd000 C:\Windows\system32\KERNEL32.DLL 0x00007ffb10220000 - 0x00007ffb10408000 C:\Windows\system32\KERNELBASE.dll 0x00007ffb13910000 - 0x00007ffb139b7000 C:\Windows\system32\ADVAPI32.dll 0x00007ffb13870000 - 0x00007ffb1390d000 C:\Windows\system32\msvcrt.dll 0x00007ffb12d30000 - 0x00007ffb12d8b000 C:\Windows\system32\sechost.dll 0x00007ffb12f80000 - 0x00007ffb1309c000 C:\Windows\system32\RPCRT4.dll 0x00007ffb13390000 - 0x00007ffb134e6000 C:\Windows\system32\USER32.dll 0x00007ffb12df0000 - 0x00007ffb12f76000 C:\Windows\system32\GDI32.dll 0x00007ffb0bbb0000 - 0x00007ffb0be24000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.10586.589_none_a2ddb3caa539acce\COMCTL32.dll 0x00007ffb10ff0000 - 0x00007ffb1126d000 C:\Windows\system32\combase.dll 0x00007ffb10600000 - 0x00007ffb1066a000 C:\Windows\system32\bcryptPrimitives.dll 0x00007ffb13ad0000 - 0x00007ffb13b0b000 C:\Windows\system32\IMM32.DLL 0x000000005b690000 - 0x000000005b761000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\msvcr100.dll 0x000000005b770000 - 0x000000005c00a000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\server\jvm.dll 0x00007ffb13b10000 - 0x00007ffb13b18000 C:\Windows\system32\PSAPI.DLL 0x00007ffb0bee0000 - 0x00007ffb0beea000 C:\Windows\SYSTEM32\VERSION.dll 0x00007ffb0cf30000 - 0x00007ffb0cf39000 C:\Windows\SYSTEM32\WSOCK32.dll 0x00007ffb0e7e0000 - 0x00007ffb0e803000 C:\Windows\SYSTEM32\WINMM.dll 0x00007ffb134f0000 - 0x00007ffb1355b000 C:\Windows\system32\WS2_32.dll 0x0000000002c40000 - 0x0000000002c6c000 C:\Windows\SYSTEM32\WINMMBASE.dll 0x00007ffb101d0000 - 0x00007ffb10213000 C:\Windows\system32\cfgmgr32.dll 0x000000005cd10000 - 0x000000005cd1f000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\verify.dll 0x000000005cad0000 - 0x000000005caf9000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\java.dll 0x000000005ccf0000 - 0x000000005cd06000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\zip.dll 0x00007ffb116c0000 - 0x00007ffb12c1c000 C:\Windows\system32\SHELL32.dll 0x00007ffb10840000 - 0x00007ffb10e85000 C:\Windows\system32\windows.storage.dll 0x00007ffb13330000 - 0x00007ffb13382000 C:\Windows\system32\shlwapi.dll 0x00007ffb10170000 - 0x00007ffb1017f000 C:\Windows\system32\kernel.appcore.dll 0x00007ffb10430000 - 0x00007ffb104e5000 C:\Windows\system32\shcore.dll 0x00007ffb10180000 - 0x00007ffb101cb000 C:\Windows\system32\powrprof.dll 0x00007ffb10140000 - 0x00007ffb10154000 C:\Windows\system32\profapi.dll 0x00000005c9f70000 - 0x00000005c9f88000 C:\Users\Moe\Desktop\Projects\IntelligentCloud\IntelligentCloudLibrary\build\libs\main\shared\main.dll 0x00000003ff750000 - 0x00000003ff76a000 C:\cygwin64\bin\cyggcc_s-seh-1.dll 0x00000003febd0000 - 0x00000003fed22000 C:\cygwin64\bin\cygstdc++-6.dll 0x0000000180040000 - 0x0000000180610000 C:\cygwin64\bin\cygwin1.dll 0x00007ffb0cb00000 - 0x00007ffb0cc8c000 C:\Windows\SYSTEM32\dbghelp.dll VM Arguments: jvm_args: -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant java_command: Main java_class_path (initial): C:\Users\Moe\Desktop\Projects\IntelligentCloud\IntelligentCloudApp\build\classes\main;C:\Users\Moe\Desktop\Projects\IntelligentCloud\IntelligentCloudApp\build\resources\main Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102 PATH=C:\cygwin64\bin;C:\\PROGRA~1\\rti_connext_dds-5.2.3\;C:\\PROGRA~1\\rti_connext_dds-5.2.3\\bin;C:\Program Files\ArrayFire\v3\lib;C:\Program Files\Java\jdk1.8.0_102\bin USERNAME=Moe OS=Windows_NT PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel --------------- S Y S T E M --------------- OS: Windows 10.0 , 64 bit Build 10586 (10.0.10586.589) CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, tsc, tscinvbit, bmi1, bmi2, adx Memory: 4k page, physical 16647436k(9117744k free), swap 19137804k(9821056k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (25.102-b14) for windows-amd64 JRE (1.8.0_102-b14), built on Jun 22 2016 13:15:21 by "java_re" with MS VC++ 10.0 (VS2010) time: Mon Sep 26 13:31:32 2016 elapsed time: 0 seconds (0d 0h 0m 0s)
I seem to have a big problem when trying to compile C++ code to use on the JAVA side. When I try to do anything IO/Stream/Manipulation related, the JVM seems to crash.
Sometimes, like once every 10 times when I run the application, the JNI works 100% with all the IO stuff. Then the rest of the times the JVM crashes or hangs.
I'm using: Windows 10 x64, JAVA jdk1.8.0_102, Netbeans 8.1, g++, additional options: -D__int64=int64_t
When I do these, the JNI works fine:
JNIEXPORT jstring JNICALL Java_Main_nativePrint (JNIEnv *env, jobject) { return env->NewStringUTF("HELLO"); } JNIEXPORT jstring JNICALL Java_Main_nativePrint (JNIEnv *env, jobject) { double var = std::sqrt(100); return env->NewStringUTF("HELLO"); }
When I try incorporating anything such as
printf
,std::stringstream
,sprintf
,cout
, orputs
, the JVM crashes. Even instantiating thestd::stringstream
seems to crash me. I assume other sorts of manipulation function also crashes me:Java_Main_nativePrint(JNIEnv *env, jobject instance) { int variable = 100; char str[15]; //CRASHES ON HERE sprintf(str, "%d", variable); //CRASHES ON HERE IF ABOVE COMMENTED OUT OR USING ANOTHER CHAR ARRAY. puts(str); //CRASHES ON HERE return env->NewStringUTF(str); } JNIEXPORT jstring JNICALL Java_Main_nativePrint (JNIEnv *env, jobject) { double res = std::sqrt(100); //CRASHES HERE ON INSTANTATION OF stringstream std::stringstream ss; //ss << std::sqrt(100); //const char* str = ss.str().c_str(); return env->NewStringUTF("HELLO"); }
I seem to be having a similar problem to this person:
JNI with c++ keeps crashing on cout, printf and method calls
Here's my dump:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180117a37, pid=6064, tid=0x0000000000002e40 # # JRE version: Java(TM) SE Runtime Environment (8.0_102-b14) (build 1.8.0_102-b14) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [cygwin1.dll+0xd7a37] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x0000000002e70800): JavaThread "main" [_thread_in_native, id=11840, stack(0x0000000002d70000,0x0000000002e70000)] siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000000 Registers: RAX=0x0000000000000000, RBX=0x0000000002e6f328, RCX=0x00000003fec8bfe0, RDX=0x00000003fec5ee60 RSP=0x0000000002e6f100, RBP=0x0000000000000018, RSI=0x0000000002e6f258, RDI=0x0000000002f7835d R8 =0x0000000002e6f298, R9 =0x0000000002d67610, R10=0x0000000002e70000, R11=0x00000003fec5ee08 R12=0x0000000000000000, R13=0x000000001bf903f0, R14=0x0000000002e6f420, R15=0x0000000002e70800 RIP=0x0000000180117a37, EFLAGS=0x0000000000010202 Top of Stack: (sp=0x0000000002e6f100) 0x0000000002e6f100: 00000001800f0390 0000000180117a4b 0x0000000002e6f110: 0000000002d6eee0 0000000002d6eee8 0x0000000002e6f120: 0000000002e70800 000000005b94a34e 0x0000000002e6f130: 0000000002e6f328 00000003fec62d16 0x0000000002e6f140: 000000005bd50088 0000005000000000 0x0000000002e6f150: 0000000000000015 0000000000000000 0x0000000002e6f160: 0000000002e6f1f0 0000000002e6f258 0x0000000002e6f170: 0000000002f7835d 00000003fec58d59 0x0000000002e6f180: 0000000000000000 0000000000000100 0x0000000002e6f190: 0000000000000002 0000000002d6ebf0 0x0000000002e6f1a0: 0000000002e70800 000000001bf903f0 0x0000000002e6f1b0: 0000000020200021 0000000002f7835d 0x0000000002e6f1c0: 0000000002e6f250 00000005c9f710e4 0x0000000002e6f1d0: 0000000000000010 0000000000000008 0x0000000002e6f1e0: 0000000002e70800 0000000002f93b63 0x0000000002e6f1f0: 000000001bf903f0 0000000002e70800 Instructions: (pc=0x0000000180117a37) 0x0000000180117a17: 04 f3 90 eb e3 48 c7 c0 08 00 00 00 49 0f c1 82 0x0000000180117a27: 50 e4 ff ff 4c 8d 1d 19 00 00 00 4c 87 5c 24 08 0x0000000180117a37: 4c 89 18 41 ff 82 44 e4 ff ff 41 ff 8a 4c e4 ff 0x0000000180117a47: ff 58 ff e0 65 4c 8b 14 25 08 00 00 00 41 bb 01 Register to memory mapping: RAX=0x0000000000000000 is an unknown value RBX=0x0000000002e6f328 is pointing into the stack for thread: 0x0000000002e70800 RCX=0x00000003fec8bfe0 is an unknown value RDX=0x00000003fec5ee60 is an unknown value RSP=0x0000000002e6f100 is pointing into the stack for thread: 0x0000000002e70800 RBP=0x0000000000000018 is an unknown value RSI=0x0000000002e6f258 is pointing into the stack for thread: 0x0000000002e70800 RDI=0x0000000002f7835d is at code_begin+2301 in an Interpreter codelet invoke return entry points [0x0000000002f77a60, 0x0000000002f78440] 2528 bytes R8 =0x0000000002e6f298 is pointing into the stack for thread: 0x0000000002e70800 R9 =0x0000000002d67610 is an unknown value R10=0x0000000002e70000 is pointing into the stack for thread: 0x0000000002e70800 R11=0x00000003fec5ee08 is an unknown value R12=0x0000000000000000 is an unknown value R13={method} {0x000000001bf903f8} 'nativePrint' '()Ljava/lang/String;' in 'Main' R14=0x0000000002e6f420 is pointing into the stack for thread: 0x0000000002e70800 R15=0x0000000002e70800 is a thread Stack: [0x0000000002d70000,0x0000000002e70000], sp=0x0000000002e6f100, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [cygwin1.dll+0xd7a37] C [cygwin1.dll+0xb038f] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j Main.nativePrint()Ljava/lang/String;+0 j Main.main([Ljava/lang/String;)V+18 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x000000001dea8800 JavaThread "Service Thread" daemon [_thread_blocked, id=3408, stack(0x000000001e280000,0x000000001e380000)] 0x000000001c538800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=5372, stack(0x000000001dd80000,0x000000001de80000)] 0x000000001c535800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5400, stack(0x000000001dc80000,0x000000001dd80000)] 0x000000001c531000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=5124, stack(0x000000001db80000,0x000000001dc80000)] 0x000000001c52f000 JavaThread "Attach Listener" daemon [_thread_blocked, id=2432, stack(0x000000001da80000,0x000000001db80000)] 0x000000001c52e000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=336, stack(0x000000001d980000,0x000000001da80000)] 0x0000000002f6a800 JavaThread "Finalizer" daemon [_thread_blocked, id=11892, stack(0x000000001d7a0000,0x000000001d8a0000)] 0x0000000002f61000 JavaThread "Reference Handler" daemon [_thread_blocked, id=11932, stack(0x000000001d6a0000,0x000000001d7a0000)] =>0x0000000002e70800 JavaThread "main" [_thread_in_native, id=11840, stack(0x0000000002d70000,0x0000000002e70000)] Other Threads: 0x000000001c4f8000 VMThread [stack: 0x000000001d5a0000,0x000000001d6a0000] [id=13280] 0x000000001ded3000 WatcherThread [stack: 0x000000001e380000,0x000000001e480000] [id=11656] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap: PSYoungGen total 76288K, used 2621K [0x000000076b500000, 0x0000000770a00000, 0x00000007c0000000) eden space 65536K, 4% used [0x000000076b500000,0x000000076b78f5e8,0x000000076f500000) from space 10752K, 0% used [0x000000076ff80000,0x000000076ff80000,0x0000000770a00000) to space 10752K, 0% used [0x000000076f500000,0x000000076f500000,0x000000076ff80000) ParOldGen total 175104K, used 0K [0x00000006c1e00000, 0x00000006cc900000, 0x000000076b500000) object space 175104K, 0% used [0x00000006c1e00000,0x00000006c1e00000,0x00000006cc900000) Metaspace used 2586K, capacity 4486K, committed 4864K, reserved 1056768K class space used 282K, capacity 386K, committed 512K, reserved 1048576K Card table byte_map: [0x0000000012330000,0x0000000012b30000] byte_map_base: 0x000000000ed21000 Marking Bits: (ParMarkBitMap*) 0x000000005bf8a6c0 Begin Bits: [0x0000000013480000, 0x0000000017408000) End Bits: [0x0000000017408000, 0x000000001b390000) Polling page: 0x0000000002c00000 CodeCache: size=245760Kb used=1102Kb max_used=1105Kb free=244657Kb bounds [0x0000000002f70000, 0x00000000031e0000, 0x0000000011f70000] total_blobs=254 nmethods=23 adapters=145 compilation: enabled Compilation events (10 events): Event: 0.060 Thread 0x000000001c538800 18 s 3 java.lang.StringBuffer::append (13 bytes) Event: 0.060 Thread 0x000000001c535800 20 4 java.lang.String::charAt (29 bytes) Event: 0.060 Thread 0x000000001c538800 nmethod 18 0x0000000003080210 code [0x00000000030803c0, 0x0000000003080af8] Event: 0.060 Thread 0x000000001c538800 21 3 java.lang.AbstractStringBuilder::append (50 bytes) Event: 0.061 Thread 0x000000001c538800 nmethod 21 0x0000000003080ed0 code [0x00000000030810a0, 0x00000000030817f8] Event: 0.061 Thread 0x000000001c538800 22 3 java.lang.String::indexOf (7 bytes) Event: 0.061 Thread 0x000000001c535800 nmethod 20 0x00000000030847d0 code [0x0000000003084920, 0x00000000030849f8] Event: 0.061 Thread 0x000000001c538800 nmethod 22 0x00000000030843d0 code [0x0000000003084540, 0x0000000003084748] Event: 0.064 Thread 0x000000001c538800 23 3 java.util.Arrays::copyOfRange (63 bytes) Event: 0.064 Thread 0x000000001c538800 nmethod 23 0x0000000003082950 code [0x0000000003082b60, 0x0000000003083698] GC Heap History (0 events): No events Deoptimization events (0 events): No events Internal exceptions (2 events): Event: 0.025 Thread 0x0000000002e70800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x000000076b507c78) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u102\7268\hotspot\s�4�B��? Event: 0.025 Thread 0x0000000002e70800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x000000076b507f60) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u102\7268\hotspot\src\share\vm\prims\ Events (10 events): Event: 0.063 loading class java/security/UnresolvedPermission Event: 0.063 loading class java/security/UnresolvedPermission done Event: 0.064 loading class java/security/BasicPermissionCollection Event: 0.064 loading class java/security/BasicPermissionCollection done Event: 0.064 loading class sun/launcher/LauncherHelper$FXHelper Event: 0.064 loading class sun/launcher/LauncherHelper$FXHelper done Event: 0.064 loading class java/lang/Class$MethodArray Event: 0.064 loading class java/lang/Class$MethodArray done Event: 0.064 loading class java/lang/Void Event: 0.064 loading class java/lang/Void done Dynamic libraries: 0x00007ff77e020000 - 0x00007ff77e057000 C:\Program Files\Java\jdk1.8.0_102\bin\java.exe 0x00007ffb13b20000 - 0x00007ffb13ce1000 C:\Windows\SYSTEM32\ntdll.dll 0x00007ffb13110000 - 0x00007ffb131bd000 C:\Windows\system32\KERNEL32.DLL 0x00007ffb10220000 - 0x00007ffb10408000 C:\Windows\system32\KERNELBASE.dll 0x00007ffb13910000 - 0x00007ffb139b7000 C:\Windows\system32\ADVAPI32.dll 0x00007ffb13870000 - 0x00007ffb1390d000 C:\Windows\system32\msvcrt.dll 0x00007ffb12d30000 - 0x00007ffb12d8b000 C:\Windows\system32\sechost.dll 0x00007ffb12f80000 - 0x00007ffb1309c000 C:\Windows\system32\RPCRT4.dll 0x00007ffb13390000 - 0x00007ffb134e6000 C:\Windows\system32\USER32.dll 0x00007ffb12df0000 - 0x00007ffb12f76000 C:\Windows\system32\GDI32.dll 0x00007ffb0bbb0000 - 0x00007ffb0be24000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.10586.589_none_a2ddb3caa539acce\COMCTL32.dll 0x00007ffb10ff0000 - 0x00007ffb1126d000 C:\Windows\system32\combase.dll 0x00007ffb10600000 - 0x00007ffb1066a000 C:\Windows\system32\bcryptPrimitives.dll 0x00007ffb13ad0000 - 0x00007ffb13b0b000 C:\Windows\system32\IMM32.DLL 0x000000005b690000 - 0x000000005b761000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\msvcr100.dll 0x000000005b770000 - 0x000000005c00a000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\server\jvm.dll 0x00007ffb13b10000 - 0x00007ffb13b18000 C:\Windows\system32\PSAPI.DLL 0x00007ffb0bee0000 - 0x00007ffb0beea000 C:\Windows\SYSTEM32\VERSION.dll 0x00007ffb0cf30000 - 0x00007ffb0cf39000 C:\Windows\SYSTEM32\WSOCK32.dll 0x00007ffb0e7e0000 - 0x00007ffb0e803000 C:\Windows\SYSTEM32\WINMM.dll 0x00007ffb134f0000 - 0x00007ffb1355b000 C:\Windows\system32\WS2_32.dll 0x0000000002c40000 - 0x0000000002c6c000 C:\Windows\SYSTEM32\WINMMBASE.dll 0x00007ffb101d0000 - 0x00007ffb10213000 C:\Windows\system32\cfgmgr32.dll 0x000000005cd10000 - 0x000000005cd1f000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\verify.dll 0x000000005cad0000 - 0x000000005caf9000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\java.dll 0x000000005ccf0000 - 0x000000005cd06000 C:\Program Files\Java\jdk1.8.0_102\jre\bin\zip.dll 0x00007ffb116c0000 - 0x00007ffb12c1c000 C:\Windows\system32\SHELL32.dll 0x00007ffb10840000 - 0x00007ffb10e85000 C:\Windows\system32\windows.storage.dll 0x00007ffb13330000 - 0x00007ffb13382000 C:\Windows\system32\shlwapi.dll 0x00007ffb10170000 - 0x00007ffb1017f000 C:\Windows\system32\kernel.appcore.dll 0x00007ffb10430000 - 0x00007ffb104e5000 C:\Windows\system32\shcore.dll 0x00007ffb10180000 - 0x00007ffb101cb000 C:\Windows\system32\powrprof.dll 0x00007ffb10140000 - 0x00007ffb10154000 C:\Windows\system32\profapi.dll 0x00000005c9f70000 - 0x00000005c9f88000 C:\Users\Moe\Desktop\Projects\IntelligentCloud\IntelligentCloudLibrary\build\libs\main\shared\main.dll 0x00000003ff750000 - 0x00000003ff76a000 C:\cygwin64\bin\cyggcc_s-seh-1.dll 0x00000003febd0000 - 0x00000003fed22000 C:\cygwin64\bin\cygstdc++-6.dll 0x0000000180040000 - 0x0000000180610000 C:\cygwin64\bin\cygwin1.dll 0x00007ffb0cb00000 - 0x00007ffb0cc8c000 C:\Windows\SYSTEM32\dbghelp.dll VM Arguments: jvm_args: -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant java_command: Main java_class_path (initial): C:\Users\Moe\Desktop\Projects\IntelligentCloud\IntelligentCloudApp\build\classes\main;C:\Users\Moe\Desktop\Projects\IntelligentCloud\IntelligentCloudApp\build\resources\main Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102 PATH=C:\cygwin64\bin;C:\\PROGRA~1\\rti_connext_dds-5.2.3\;C:\\PROGRA~1\\rti_connext_dds-5.2.3\\bin;C:\Program Files\ArrayFire\v3\lib;C:\Program Files\Java\jdk1.8.0_102\bin USERNAME=Moe OS=Windows_NT PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel --------------- S Y S T E M --------------- OS: Windows 10.0 , 64 bit Build 10586 (10.0.10586.589) CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, tsc, tscinvbit, bmi1, bmi2, adx Memory: 4k page, physical 16647436k(9117744k free), swap 19137804k(9821056k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (25.102-b14) for windows-amd64 JRE (1.8.0_102-b14), built on Jun 22 2016 13:15:21 by "java_re" with MS VC++ 10.0 (VS2010) time: Mon Sep 26 13:31:32 2016 elapsed time: 0 seconds (0d 0h 0m 0s)
原文:https://stackoverflow.com/questions/39709501
最满意答案
至少在我的情况下,似乎使用IDENTITY_H的编码实际上阻止了iText嵌入整个字体。 我将编码改为CP1250,一切都按预期工作。
It appears, at least in my case, that using encoding of IDENTITY_H actually prevented iText from embedding the entire font. I changed encoding to CP1250 and everything worked as expected.
相关问答
更多-
您可以在表单中添加更改字段内容的JavaScript。 例如,请参阅计算器示例,了解充当计算器的有趣PDF(显然,此应用程序仅适用于支持JavaScript的PDF查看器)。 创建文本字段时,需要使用setAdditionalActions()方法添加其他操作。 您可以选择不同的事件: K用于击键(例如,如果您想在某人填写表格时将每个字符更改为大写,则非常有用), Bl表示模糊(用于在焦点丢失时立即处理字段内容)等 您可以编写自己的文档级JavaScript来格式化字段。 有关Calculator示例中使用 ...
-
您创建文本域窗口小部件注释 PdfFormField ffield = note1.GetTextField(); 并为其添加模糊操作 ffield.SetAdditionalActions(PdfName.BL, PdfAction.JavaScript("app.alert('action!')", stamp.Writer)); 然后您创建另一个窗口小部件注释(没有模糊操作)并仅将此新注释添加到PDF: stamp.AddAnnotation(note1.GetTextField(), 1); ...
-
我已经检查了更改日志,我看到在iText 5.2.0中更改了itext-asian.jar。 从那一刻开始,你需要额外的时间2.2 。 iText 5.0.5的日期为2010年11月2日 。 当我检查extrajars-2.1的内容时,我发现它包含一个可以追溯到2011年5月21日的itext-asian.jar。 然后我检查了extrajars-2.0 ,令我惊讶的是,它还包含了一个2011年5月6日的itext-asian.jar。 我猜这些extrajars zip文件在5年前同时更新。 我认为ite ...
-
因为再次调用setOptions()时,内部值将被覆盖。 如果要同时使用这两个功能,则必须组合选项并一次保存所有选项: textField.setOptions(TextField.MULTILINE | TextField.READ_ONLY); Because when you call the setOptions() again, the internal value will be overrided. If you want to use both feature, you must comb ...
-
至少在我的情况下,似乎使用IDENTITY_H的编码实际上阻止了iText嵌入整个字体。 我将编码改为CP1250,一切都按预期工作。 It appears, at least in my case, that using encoding of IDENTITY_H actually prevented iText from embedding the entire font. I changed encoding to CP1250 and everything worked as expected.
-
iText编码问题(iText encoding problem)[2022-04-21]
您的默认区域设置是否正确设置? 确保Locale.getDefault()返回它应该的值。 在windows和linux上,如果其中一个没有正确设置,这可能会有所不同。 Is your default Locale set properly? Make sure that Locale.getDefault() is returning the value it should be. This could be different on windows and linux, if one of them h ... -
试试这样 func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { // set maximum length for password and confirm password if textField == txtPassword { // if textfield password is editing ...
-
这是解决方案: PdfFont normalFont = PdfFontFactory.createFont("C:\\Windows\\Fonts\\arial.ttf", "Identity-H", true); 您可以使用任何支持您的语言的字体。 Identity-H似乎也是PDF文件编码的重要组成部分。 This is the solution: PdfFont normalFont = PdfFontFactory.createFont("C:\\Windows\\Fonts\\arial.tt ...
-
如何使用iText / Sharp从AcroFields获取TextField?(How do I get a TextField from AcroFields using iText/Sharp?)[2021-12-27]
不幸的是, TextField , PushButtonField和其他都是iText文档创建抽象的一部分,并且没有内置的方法将AcroFields.Item对象反转回其中一个。 Unfortunately no, TextField, PushButtonField and others are all part of iText's abstraction for document creation and there's no built-in way to reverse an AcroFields ... -
我找到了一个解决方案。 更改外部Textfield EventDispatcher并解决问题 EventDispatcher dispatcher = externalTextField.getEventDispatcher(); 然后在内部TextField的焦点上 externalTextField.setEventDispatcher(interntalTextField.getEventDispatcher()); 当失去焦点时恢复EventDispatcher externalTextFiel ...