Skip to main content

" The crash happened outside the Java Virtual Machine in native code.”how to solve this error (Java)?



Using the library in this link http://www.blog.kslemb.com/doku.php/en/projects/globx/java_hid





I have been modfied this code to write on a HID terminal







if (HIDHandle.equals(WinBase.INVALID_HANDLE_VALUE)) {

return HID_DEVICE_NOT_OPENED;

}

/* Write Feature report */

boolean Status=Kernel32.INSTANCE.WriteFile(HIDHandle, buffer, (int)buffersize, null, null);

if (Status == false) {

debug("Write File: " + getSystemError(Kernel32.INSTANCE.GetLastError()));

return HID_DEVICE_TRANSFER_FAILED;

} else {

return HID_DEVICE_SUCCESS;

}







This code would successfully writes on the HID device but then it would produce this error







A fatal error has been detected by the Java Runtime Environment:

#

# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7600d4d5, pid=4660, tid=3780

#

# JRE version: 6.0_27-b07

# Java VM: Java HotSpot(TM) Client VM (20.2-b06 mixed mode, sharing windows-x86 )

# Problematic frame:

# C [KERNELBASE.dll+0xd4d5]

#

# An error report file with more information is saved as:

# D:\eng\senior_project\usb\NetBeansProjects\USB\hs_err_pid4660.log

#

# If you would like to submit a bug report, please visit:

# http://java.sun.com/webapps/bugreport/crash.jsp

# The crash happened outside the Java Virtual Machine in native code.

# See problematic frame for where to report the bug







and These what appear in the log file







a#

# A fatal error has been detected by the Java Runtime Environment:

#

# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7600d4d5, pid=180, tid=4348

#

# JRE version: 6.0_27-b07

# Java VM: Java HotSpot(TM) Client VM (20.2-b06 mixed mode, sharing windows-x86 )

# Problematic frame:

# C [KERNELBASE.dll+0xd4d5]

#

# If you would like to submit a bug report, please visit:

# http://java.sun.com/webapps/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 (0x001e9000): JavaThread "main" [_thread_in_native, id=4348, stack(0x001f0000,0x00240000)]



siginfo: ExceptionCode=0xc0000005, writing address 0x00000000



Registers:

EAX=0x00000005, EBX=0x000002f8, ECX=0x001df148, EDX=0x0023f750

ESP=0x0023f738, EBP=0x0023f770, ESI=0x00000000, EDI=0x00000000

EIP=0x7600d4d5, EFLAGS=0x00010246



Top of Stack: (sp=0x0023f738)

0x0023f738: 165f7936 0023f8c0 00000000 00000000

0x0023f748: 0023f77c 00000004 00000000 00000005

0x0023f758: 0023f738 0023f300 0023fdd4 76036590

0x0023f768: 607ff39e fffffffe 0023f78c 76e512cc

0x0023f778: 000002f8 0211c3c8 00000005 00000000

0x0023f788: 00000000 0023f7a8 1000cb77 000002f8

0x0023f798: 0211c3c8 00000005 00000000 00000000

0x0023f7a8: 0023f7e8 1000c7c2 1000c5a0 0023f7d0



Instructions: (pc=0x7600d4d5)

0x7600d4b5: 3d 03 01 00 00 75 12 6a 00 6a 00 53 ff 15 64 10

0x7600d4c5: 00 76 85 c0 7c 0e 8b 45 e0 85 c0 7c 07 8b 45 e4

0x7600d4d5: 89 07 eb c2 8b c8 81 e1 00 00 00 c0 81 f9 00 00

0x7600d4e5: 00 80 75 05 8b 4d e4 89 0f 50 e8 1e 98 02 00 33





Register to memory mapping:



EAX=0x00000005 is an unknown value

EBX=0x000002f8 is an unknown value

ECX=0x001df148 is an unknown value

EDX=0x0023f750 is pointing into the stack for thread: 0x001e9000

ESP=0x0023f738 is pointing into the stack for thread: 0x001e9000

EBP=0x0023f770 is pointing into the stack for thread: 0x001e9000

ESI=0x00000000 is an unknown value

EDI=0x00000000 is an unknown value





Stack: [0x001f0000,0x00240000], sp=0x0023f738, free space=317k

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

C [KERNELBASE.dll+0xd4d5] WriteFile+0x133

C [kernel32.dll+0x112cc] WriteFile+0x4a

C [jna6285930827620941734.dll+0xcb77] Java_com_sun_jna_Native_initialize_1ffi_1type+0x37d7

C [jna6285930827620941734.dll+0xc7c2] Java_com_sun_jna_Native_initialize_1ffi_1type+0x3422

C [jna6285930827620941734.dll+0x4561] Java_com_sun_jna_Pointer__1getString+0xa31

C [jna6285930827620941734.dll+0x4d2e] Java_com_sun_jna_Function_invokeInt+0x2e

j com.sun.jna.Function.invokeInt(I[Ljava/lang/Object;)I+0

j com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;Z)Ljava/lang/Object;+315

j com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+214

j com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+341

j $Proxy2.WriteFile(Lcom/sun/jna/platform/win32/WinNT$HANDLE;[BILcom/sun/jna/ptr/IntByReference;Lcom/sun/jna/platform/win32/WinBase$OVERLAPPED;)Z+37

j usb.Communication.SetFeatureReport([BS)B+29

j usb.USB.main([Ljava/lang/String;)V+62

v ~StubRoutines::call_stub

V [jvm.dll+0xfac3b]

V [jvm.dll+0x18c391]

V [jvm.dll+0xfacbd]

V [jvm.dll+0x95776]

V [jvm.dll+0x9d5b3]

C [java.exe+0x2155]

C [java.exe+0x85b4]

C [kernel32.dll+0x1339a] BaseThreadInitThunk+0x12

C [ntdll.dll+0x39ef2] RtlInitializeExceptionChain+0x63

C [ntdll.dll+0x39ec5] RtlInitializeExceptionChain+0x36



Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)

j com.sun.jna.Function.invokeInt(I[Ljava/lang/Object;)I+0

j com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;Z)Ljava/lang/Object;+315

j com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+214

j com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+341

j $Proxy2.WriteFile(Lcom/sun/jna/platform/win32/WinNT$HANDLE;[BILcom/sun/jna/ptr/IntByReference;Lcom/sun/jna/platform/win32/WinBase$OVERLAPPED;)Z+37

j usb.Communication.SetFeatureReport([BS)B+29

j usb.USB.main([Ljava/lang/String;)V+62

v ~StubRoutines::call_stub



--------------- P R O C E S S ---------------



Java Threads: ( => current thread )

0x020f1c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2628, stack(0x045e0000,0x04630000)]

0x020ed000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=3440, stack(0x04550000,0x045a0000)]

0x020ec000 JavaThread "Attach Listener" daemon [_thread_blocked, id=1904, stack(0x044c0000,0x04510000)]

0x020e9000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4148, stack(0x04430000,0x04480000)]

0x020dec00 JavaThread "Finalizer" daemon [_thread_blocked, id=3336, stack(0x043a0000,0x043f0000)]

0x020dcc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=3196, stack(0x04310000,0x04360000)]

=>0x001e9000 JavaThread "main" [_thread_in_native, id=4348, stack(0x001f0000,0x00240000)]



Other Threads:

0x020a0800 VMThread [stack: 0x04280000,0x042d0000] [id=4704]

0x02100400 WatcherThread [stack: 0x04670000,0x046c0000] [id=4352]



VM state:not at safepoint (normal execution)



VM Mutex/Monitor currently owned by a thread: None



Heap

def new generation total 4928K, used 2462K [0x241e0000, 0x24730000, 0x29730000)

eden space 4416K, 55% used [0x241e0000, 0x24447bb0, 0x24630000)

from space 512K, 0% used [0x24630000, 0x24630000, 0x246b0000)

to space 512K, 0% used [0x246b0000, 0x246b0000, 0x24730000)

tenured generation total 10944K, used 0K [0x29730000, 0x2a1e0000, 0x341e0000)

the space 10944K, 0% used [0x29730000, 0x29730000, 0x29730200, 0x2a1e0000)

compacting perm gen total 12288K, used 669K [0x341e0000, 0x34de0000, 0x381e0000)

the space 12288K, 5% used [0x341e0000, 0x342877e8, 0x34287800, 0x34de0000)

ro space 10240K, 54% used [0x381e0000, 0x3875f548, 0x3875f600, 0x38be0000)

rw space 12288K, 55% used [0x38be0000, 0x39285140, 0x39285200, 0x397e0000)



Code Cache [0x02170000, 0x02200000, 0x04170000)

total_blobs=201 nmethods=66 adapters=71 free_code_cache=32980800 largest_free_block=0



Dynamic libraries:

0x00400000 - 0x00424000 C:\Program Files (x86)\Java\jdk1.6.0_27\bin\java.exe

0x77420000 - 0x775a0000 C:\Windows\SysWOW64\ntdll.dll

0x76e40000 - 0x76f50000 C:\Windows\syswow64\kernel32.dll

0x76000000 - 0x76046000 C:\Windows\syswow64\KERNELBASE.dll

0x76920000 - 0x769c0000 C:\Windows\syswow64\ADVAPI32.dll

0x76f50000 - 0x76ffc000 C:\Windows\syswow64\msvcrt.dll

0x75d80000 - 0x75d99000 C:\Windows\SysWOW64\sechost.dll

0x767d0000 - 0x768c0000 C:\Windows\syswow64\RPCRT4.dll

0x74f80000 - 0x74fe0000 C:\Windows\syswow64\SspiCli.dll

0x74f70000 - 0x74f7c000 C:\Windows\syswow64\CRYPTBASE.dll

0x7c340000 - 0x7c396000 C:\Program Files (x86)\Java\jdk1.6.0_27\jre\bin\msvcr71.dll

0x6d8a0000 - 0x6db4f000 C:\Program Files (x86)\Java\jdk1.6.0_27\jre\bin\client\jvm.dll

0x76ae0000 - 0x76be0000 C:\Windows\syswow64\USER32.dll

0x76730000 - 0x767c0000 C:\Windows\syswow64\GDI32.dll

0x75ca0000 - 0x75caa000 C:\Windows\syswow64\LPK.dll

0x76da0000 - 0x76e3d000 C:\Windows\syswow64\USP10.dll

0x745c0000 - 0x745f2000 C:\Windows\system32\WINMM.dll

0x76be0000 - 0x76c40000 C:\Windows\system32\IMM32.DLL

0x76050000 - 0x7611c000 C:\Windows\syswow64\MSCTF.dll

0x71540000 - 0x7158c000 C:\Windows\system32\apphelp.dll

0x6d850000 - 0x6d85c000 C:\Program Files (x86)\Java\jdk1.6.0_27\jre\bin\verify.dll

0x6d3d0000 - 0x6d3ef000 C:\Program Files (x86)\Java\jdk1.6.0_27\jre\bin\java.dll

0x6d890000 - 0x6d89f000 C:\Program Files (x86)\Java\jdk1.6.0_27\jre\bin\zip.dll

0x743e0000 - 0x743f6000 C:\Windows\system32\CRYPTSP.dll

0x743a0000 - 0x743db000 C:\Windows\system32\rsaenh.dll

0x71090000 - 0x710a7000 C:\Windows\system32\USERENV.dll

0x74380000 - 0x7438b000 C:\Windows\system32\profapi.dll

0x6d6b0000 - 0x6d6c3000 C:\Program Files (x86)\Java\jdk1.6.0_27\jre\bin\net.dll

0x76120000 - 0x76155000 C:\Windows\syswow64\WS2_32.dll

0x773f0000 - 0x773f6000 C:\Windows\syswow64\NSI.dll

0x74690000 - 0x746cc000 C:\Windows\system32\mswsock.dll

0x72e40000 - 0x72e46000 C:\Windows\System32\wship6.dll

0x746d0000 - 0x746e0000 C:\Windows\system32\NLAapi.dll

0x74620000 - 0x74630000 C:\Windows\system32\napinsp.dll

0x74600000 - 0x74612000 C:\Windows\system32\pnrpnsp.dll

0x745b0000 - 0x745bd000 C:\Windows\system32\wshbth.dll

0x74640000 - 0x74684000 C:\Windows\system32\DNSAPI.dll

0x74630000 - 0x74638000 C:\Windows\System32\winrnr.dll

0x74550000 - 0x74555000 C:\Windows\System32\wshtcpip.dll

0x74740000 - 0x7475c000 C:\Windows\system32\IPHLPAPI.DLL

0x74730000 - 0x74737000 C:\Windows\system32\WINNSI.DLL

0x74560000 - 0x74566000 C:\Windows\system32\rasadhlp.dll

0x74570000 - 0x745a8000 C:\Windows\System32\fwpuclnt.dll

0x10000000 - 0x10055000 C:\Users\mohamed\AppData\Local\Temp\jna6285930827620941734.dll

0x75c90000 - 0x75c95000 C:\Windows\syswow64\PSAPI.DLL

0x74b80000 - 0x74b89000 C:\Windows\system32\hid.dll

0x76160000 - 0x762fd000 C:\Windows\syswow64\setupapi.dll

0x75d40000 - 0x75d67000 C:\Windows\syswow64\CFGMGR32.dll

0x76500000 - 0x7658f000 C:\Windows\syswow64\OLEAUT32.dll

0x76c40000 - 0x76d9c000 C:\Windows\syswow64\ole32.dll

0x77000000 - 0x77012000 C:\Windows\syswow64\DEVOBJ.dll

0x75c60000 - 0x75c8d000 C:\Windows\syswow64\WINTRUST.dll

0x769c0000 - 0x76add000 C:\Windows\syswow64\CRYPT32.dll

0x767c0000 - 0x767cc000 C:\Windows\syswow64\MSASN1.dll



VM Arguments:

jvm_args: -Dfile.encoding=UTF-8

java_command: usb.USB

Launcher Type: SUN_STANDARD



Environment Variables:

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;

USERNAME=mohamed

OS=Windows_NT

PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel







--------------- S Y S T E M ---------------



OS: Windows 7 , 64 bit Build 7601 Service Pack 1



CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3



Memory: 4k page, physical 3105384k(1019428k free), swap 6208920k(4162952k free)



vm_info: Java HotSpot(TM) Client VM (20.2-b06) for windows-x86 JRE (1.6.0_27-b07), built on Jul 19 2011 01:04:42 by "java_re" with MS VC++ 7.1 (VS2003)



time: Fri Feb 10 17:48:29 2012

elapsed time: 0 seconds




Comments

  1. i have found the solution to this problem ,

    boolean Status=Kernel32.INSTANCE.WriteFile(HIDHandle, buffer, (int)buffersize, null, null);


    the function doesn't accept two nulls , only one null can be passed to the function , so the correction example would be :

    IntByReference bWritten = new IntByReference();
    /* Write Feature report */
    boolean Status=Kernel32.INSTANCE.WriteFile(HIDHandle, buffer, (int)buffersize, bWritten, null);

    ReplyDelete
  2. I'm guessing you're using a Java library that has portions of it written in C (Java Native Interface). The error is happening in one of those C portions. Unless that library is something you have source code for that library, your only option would be to contact the vendor or look for an updated version.

    But check this and see if it's related.

    ReplyDelete

Post a Comment

Popular posts from this blog

Wildcards in a hosts file

I want to setup my local development machine so that any requests for *.local are redirected to localhost . The idea is that as I develop multiple sites, I can just add vhosts to Apache called site1.local , site2.local etc, and have them all resolve to localhost , while Apache serves a different site accordingly.