Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Errore codice nativo java

    Ciao a tutti!

    Sto creando una classe in java che utilizza codice nativo C, attraverso una dll che ho creato, solo che quando eseguo uno dei metodi della classe, mi da il seguente errore:

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x18062366, pid=1100, tid=5572
    #
    # JRE version: 6.0_22-b04
    # Java VM: Java HotSpot(TM) Client VM (17.1-b03 mixed mode windows-x86 )
    # Problematic frame:
    # C [WINUSB.DLL+0x2366]
    #
    # An error report file with more information is saved as:
    # J:\Utility\Java\Progetto USB\Prova\hs_err_pid1100.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.
    #

    Il metodo in questione sta utilizzando le librerie del driver generico WinUSB della microsoft che si può trovare nel pacchetto "windows driver kit", per gestire un dispositivo USB. In particolare questo metodo invia dei SET UP TOKEN all'endpoint 0.

    Se lo stesso metodo lo eseguo direttamente da un compilatore C++ funziona perfettamente.

    Qualcuno ha qualche idea di come posso risolvere il problema???



    Ecco anche il contenuto del file "hs_err_pid1100.log" che riporta l'errore in dettaglio:

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x18062366, pid=1100, tid=5572
    #
    # JRE version: 6.0_22-b04
    # Java VM: Java HotSpot(TM) Client VM (17.1-b03 mixed mode windows-x86 )
    # Problematic frame:
    # C [WINUSB.DLL+0x2366]
    #
    # 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 (0x00389c00): JavaThread "main" [_thread_in_native, id=5572, stack(0x01810000,0x01860000)]

    siginfo: ExceptionCode=0xc0000005, reading address 0x00000260

    Registers:
    EAX=0x0185fc40, EBX=0x00000000, ECX=0x0000d800, EDX=0x0185fc3f
    ESP=0x0185fbc0, EBP=0x0185fc0c, ESI=0x00000000, EDI=0x00000260
    EIP=0x18062366, EFLAGS=0x00010206

    Top of Stack: (sp=0x0185fbc0)
    0x0185fbc0: c12566c8 00389c00 00000000 13b93260
    0x0185fbd0: 0185fc3f 6dac2344 0185fc40 00000000
    0x0185fbe0: 00000001 0038a734 00389f48 00000149
    0x0185fbf0: c12566c8 0185fbc0 0185f79c 0185fd8c
    0x0185fc00: 18062bba d8a6ae74 00000000 00000260
    0x0185fc10: 00391610 00000260 0000d800 00010000
    0x0185fc20: 0185fc3f 00000001 0185fc40 00000000
    0x0185fc30: 13b93260 13b93260 0185fc7c 5585fc7c

    Instructions: (pc=0x18062366)
    0x18062356: 15 50 10 06 18 89 5d d4 8b 75 c8 e9 be 00 00 00
    0x18062366: 8b 1f 83 7d 18 00 75 0a 85 c0 75 06 8d 45 18 89


    Stack: [0x01810000,0x01860000], sp=0x0185fbc0, free space=13e0185f6dck
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [WINUSB.DLL+0x2366]

    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j prova.NativeWinUSB.SendDatatoDefaultEndpoint()Z+0
    j prova.Prova.main([Ljava/lang/StringV+60
    v ~StubRoutines::call_stub

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

    Java Threads: ( => current thread )
    0x0194b000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=7568, stack(0x17dc0000,0x17e10000)]
    0x0194a400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=6396, stack(0x17d70000,0x17dc0000)]
    0x01933800 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=5320, stack(0x17d20000,0x17d70000)]
    0x01932400 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=1448, stack(0x17cd0000,0x17d20000)]
    0x0192d800 JavaThread "JDWP Transport Listener: dt_shmem" daemon [_thread_blocked, id=1236, stack(0x17c80000,0x17cd0000)]
    0x01921c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=4148, stack(0x17c30000,0x17c80000)]
    0x0191ec00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3720, stack(0x17be0000,0x17c30000)]
    0x018f1400 JavaThread "Finalizer" daemon [_thread_blocked, id=6628, stack(0x17b90000,0x17be0000)]
    0x018efc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=7868, stack(0x17b40000,0x17b90000)]
    =>0x00389c00 JavaThread "main" [_thread_in_native, id=5572, stack(0x01810000,0x01860000)]

    Other Threads:
    0x018ed400 VMThread [stack: 0x17af0000,0x17b40000] [id=6992]
    0x01956000 WatcherThread [stack: 0x17e10000,0x17e60000] [id=6204]

    VM state:not at safepoint (normal execution)

    VM Mutex/Monitor currently owned by a thread: None

    Heap
    def new generation total 4928K, used 377K [0x039e0000, 0x03f30000, 0x08f30000)
    eden space 4416K, 8% used [0x039e0000, 0x03a3e5e8, 0x03e30000)
    from space 512K, 0% used [0x03e30000, 0x03e30000, 0x03eb0000)
    to space 512K, 0% used [0x03eb0000, 0x03eb0000, 0x03f30000)
    tenured generation total 10944K, used 0K [0x08f30000, 0x099e0000, 0x139e0000)
    the space 10944K, 0% used [0x08f30000, 0x08f30000, 0x08f30200, 0x099e0000)
    compacting perm gen total 12288K, used 1741K [0x139e0000, 0x145e0000, 0x179e0000)
    the space 12288K, 14% used [0x139e0000, 0x13b93738, 0x13b93800, 0x145e0000)
    No shared spaces configured.

    Dynamic libraries:
    0x00400000 - 0x00424000 C:\Program Files\Java\jdk1.6.0_22\bin\java.exe
    0x77480000 - 0x775bc000 C:\Windows\SYSTEM32\ntdll.dll
    0x76680000 - 0x76754000 C:\Windows\system32\kernel32.dll
    0x74e90000 - 0x74eda000 C:\Windows\system32\KERNELBASE.dll
    0x75050000 - 0x750f0000 C:\Windows\system32\ADVAPI32.dll
    0x768c0000 - 0x7696c000 C:\Windows\system32\msvcrt.dll
    0x764a0000 - 0x764b9000 C:\Windows\SYSTEM32\sechost.dll
    0x764c0000 - 0x76561000 C:\Windows\system32\RPCRT4.dll
    0x7c340000 - 0x7c396000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\msvcr71.dll
    0x6d8a0000 - 0x6db47000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\client\jvm.dll
    0x75180000 - 0x75249000 C:\Windows\system32\USER32.dll
    0x75250000 - 0x7529e000 C:\Windows\system32\GDI32.dll
    0x76490000 - 0x7649a000 C:\Windows\system32\LPK.dll
    0x76990000 - 0x76a2d000 C:\Windows\system32\USP10.dll
    0x6e800000 - 0x6e832000 C:\Windows\system32\WINMM.dll
    0x76970000 - 0x7698f000 C:\Windows\system32\IMM32.DLL
    0x756d0000 - 0x7579c000 C:\Windows\system32\MSCTF.dll
    0x74c80000 - 0x74ccb000 C:\Windows\system32\apphelp.dll
    0x6d850000 - 0x6d85c000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\verify.dll
    0x6d3d0000 - 0x6d3ef000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\java.dll
    0x6d330000 - 0x6d338000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\hpi.dll
    0x775c0000 - 0x775c5000 C:\Windows\system32\PSAPI.DLL
    0x6d420000 - 0x6d449000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\jdwp.dll
    0x6d740000 - 0x6d746000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\npt.dll
    0x6d890000 - 0x6d89f000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\zip.dll
    0x6d2a0000 - 0x6d2a8000 C:\Program Files\Java\jdk1.6.0_22\jre\bin\dt_shmem.dll
    0x00390000 - 0x00396000 J:\Utility\Java\Progetto USB\Prova\NativeWinUSBB.dll
    0x75530000 - 0x756cd000 C:\Windows\system32\SETUPAPI.dll
    0x74dd0000 - 0x74df7000 C:\Windows\system32\CFGMGR32.dll
    0x752a0000 - 0x7532f000 C:\Windows\system32\OLEAUT32.dll
    0x76760000 - 0x768bc000 C:\Windows\system32\ole32.dll
    0x75030000 - 0x75042000 C:\Windows\system32\DEVOBJ.dll
    0x18060000 - 0x18067000 C:\Windows\system32\WINUSB.DLL
    0x70ae0000 - 0x70b7b000 C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a 1e18e3b_8.0.50727.4927_none_d08a205e442db5b5\MSVCR 80.dll
    0x74ee0000 - 0x74f0d000 C:\Windows\system32\WINTRUST.dll
    0x74f10000 - 0x7502c000 C:\Windows\system32\CRYPT32.dll
    0x74dc0000 - 0x74dcc000 C:\Windows\system32\MSASN1.dll

    VM Arguments:
    jvm_args: -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug -Dfile.encoding=UTF-8
    java_command: prova.Prova
    Launcher Type: SUN_STANDARD

    Environment Variables:
    PATH=C:\Program Files\Real\RealPlayer;C:\Program Files\Real\RealPlayer\common\;C:\Windows\system32; C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Sys tem32\WindowsPowerShell\v1.0\;C:\Users\Luca\AppDat a\Local\Smartbar\Application\;C:\Program Files\MATLAB\R2009a\bin;C:\Program Files\MATLAB\R2009a\bin\win32;C:\Program Files\MKVToolNix;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Users\Luca\AppData\Local\ Smartbar\Application\;c:\MinGW\bin;C:\Programmi\Ja va\jdk1.6.0_22\bin
    USERNAME=Luca
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 16 Model 5 Stepping 3, AuthenticAMD



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

    OS: Windows 7 Build 7600

    CPU:total 3 (3 cores per cpu, 1 threads per core) family 16 model 5 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, popcnt, mmxext, 3dnow, 3dnowext, lzcnt, sse4a

    Memory: 4k page, physical 3403704k(838192k free), swap 6805644k(1508568k free)

    vm_info: Java HotSpot(TM) Client VM (17.1-b03) for windows-x86 JRE (1.6.0_22-b04), built on Sep 15 2010 00:56:36 by "java_re" with MS VC++ 7.1 (VS2003)

    time: Wed Sep 05 17:57:39 2012
    elapsed time: 10 seconds

  2. #2
    Moderatore di Programmazione L'avatar di LeleFT
    Registrato dal
    Jun 2003
    Messaggi
    17,320
    Qualcosa che non va nella DLL c'è, perchè quello è un crash della JVM dovuto a cause esterne:

    codice:
    # The crash happened outside the Java Virtual Machine in native code.
    E ti dice anche qual è la causa:
    codice:
    # Problematic frame:
    # C [WINUSB.DLL+0x2366]
    Il perchè? Lo può sapere solo chi sa capire cosa succede in quel punto.


    Ciao.
    "Perchè spendere anche solo 5 dollari per un S.O., quando posso averne uno gratis e spendere quei 5 dollari per 5 bottiglie di birra?" [Jon "maddog" Hall]
    Fatti non foste a viver come bruti, ma per seguir virtute e canoscenza

  3. #3
    Il problema però non credo sia nella DLL perchè se il codice che ho scritto nella DLL lo compilo e lo eseguo da un compilatore C non mi da problemi

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2007
    Messaggi
    4,157
    sicuro che non pastrocchi nella dll?
    ricontrollala, l'errore è li.
    Prova ad eseguire con l'ausilio di valgrind, magari ti trova dei problemi nella gestione dei puntatori (mi sembra che stai tentando di accedere ad un'area di memoria non a te concessa)
    RTFM Read That F*** Manual!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.