Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Access Violation (0xc0000005) in JNI but not when called from C++

843829Aug 4 2010 — edited Aug 16 2010
Can anyone suggest an avenue of thought for this problem?

I have a third party DLL (no source) which works fine when I call it via my own C++ code. However, as soon as I try and use JNI to call the same functions in the DLL I get the following exception;
Exception c0000005, at 48A83416
Access violation: attempting to read memory at address 00000004
Native function stack data: 0,3f49c0,20201,801a7,65637845,6f697470,3063206e,30303030
I've tried two methods of using JNI. The first is the use of a product called JNIWrapper, and that generates the above exception. However, if I use my own JNI code I get an hs_error_pid file generated saying very much the same thing.

Can anyone suggest a reason why a DLL would work fine when called via C++ but not when JNI gets involved? I'm currently use the following JVM arguments but any values I've tried here don't seem to help;
-Xcheck:jni -XX:ThreadStackSize=2m -Xss4m -Xms128m -Xmx1024m
I'm tempted to point the finger at the DLL and say that the problem is in their but I have no way to verify that and the fact that it works when called via C++ code seems to indicate to me that it's fine.

Does anyone have any ideas?

Many thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2010
Added on Aug 4 2010
6 comments
685 views