This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A fatal error cause JVM crash when running native code(C++) via JNI  RSS feed

Jeffrey Tian
Ranch Hand
Posts: 37
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I developed an application in C++ to import .DWG files(Autodesk's drawing file). The application is invoked in Java via JNI. Sometimes, the java application closes it self suddenly by an error:

# A fatal error has been detected by the Java Runtime Environment:
# Internal Error (os_windows_x86.cpp:114), pid=4280, tid=2324
# Error: guarantee(result == -1,"Unexpected result from topLevelExceptionFilter")
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0-b16 mixed mode windows-amd64 )
# If you would like to submit a bug report, please visit:
# 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 (0x000000000aa5c800): JavaThread "CommandQueue" daemon [_thread_in_native, id=2324, stack(0x0000000016ff0000,0x00000000170f0000)]

Stack: [0x0000000016ff0000,0x00000000170f0000]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j net.dirtt.icelib.main.DXFUtilities.optimized.OptimizedDXFParser.readDWG(Ljava/io/File;Lnet/dirtt/icelib/main/DXFUtilities/Unit;)V+17
j net.dirtt.icelib.main.commandmodules.ImportDXFCommand.readDXFDWGFile(Lnet/dirtt/icelib/main/DXFUtilities/DXFFile;)V+126
j net.dirtt.icelib.main.commandmodules.ImportDXFCommand.doAction()Z+169
j net.dirtt.icelib.main.commandmodules.Command.executeFromCommandQueue(Lnet/dirtt/iceconsole/IceConsole;)Z+249
j net.dirtt.icelib.main.commandmodules.CommandQueue$
v ~StubRoutines::call_stub

( is a native method)

It doesn't happen for all dwg files, just for some of them. I found it was caused by the lack of some DLLs. If I added the path which contains all DLLs from Autodesk to java.library.path, there won't be any error. There're over 100 DLLs and I don't want to put all of them into my application.

My application(a DLL file) can be loaded without any problem by Java, so my first question is: when the DLL is loaded, doesn't Java check all dependent libraries for the DLL?

My second question is: Is there a way to catch this error in my C++ code? Java crashes suddenly is too unfriendly for users. I tried using catch(...), but nothing could be caught.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!