Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to troubleshoot Java JVM load failure?

Tags:

java

jvm

I am working on a large (15MB) legacy 32bit app written in C++Builder 6 that needs to use a third party API to interact with an outside system. The API consists of a groups of DLLs that internally use Java (I am assuming JNI). Our code only interacts with one particular DLL directly, and it is delay-loaded at runtime.

When the app is run on a customer's system, the DLL is crashing for unknown reasons. So I tried to reproduce on my system (XP Pro 32bit) and ran into a different problem.

The app creates a thread that attempts to initialize the API, which internally attempts to load the Java JVM and fails, and the API reports a "JVM create failure" error back to my code.

However, the exact same thread code running in a small test app works, Java loads just fine and the API functions normally.

Both apps are run from the same folder, so it is not a path issue locating the API DLLs or the Java JVM DLLs. I also made sure both projects are using the same compiler/linker settings for memory usage, heap size, alignment, processor type, etc.

I saw a reference online suggesting that the JVM needs the address space of the calling process to have a large section of contiguous memory available, is this true? If so, how much?

I tried enabling logging/tracing in the Java control panel, but nothing useful was logged.

Is there any way to find out why Java is failing to load when called by the main app, but not the test app?

like image 366
Remy Lebeau Avatar asked Jul 02 '14 01:07

Remy Lebeau


People also ask

What causes JVM to crash?

A Java application might stop running for several reasons. The most common reason is that the application finished running or was halted normally. Other reasons might be Java application errors, exceptions that cannot be handled, and irrecoverable Java errors like OutOfMemoryError .

What is JVM error?

A heap space error occurs when the JVM has exhausted its disk space allocation. Common causes for this error include: Memory leaks — The JVM consumes memory to perform some action and does not release it when the action is completed.


1 Answers

It seems that the application is being launched with less memory.

Default memory which jre uses to launch JVM depends on system configuration. Most probably default memory is not enough large to load all classes and running OOM.

Better to replicate on your test app is to reduce heap memory to 64 and then see what is happening. This way we may be closer to get if its really a memory issue.

like image 125
Abhishek Avatar answered Sep 27 '22 20:09

Abhishek