Jni error libjvm

Hi,
i use jni to wrap a cpp-Framework. If I to start the wrapped code out of eclipse it works. (eclipse?? In a sun forum, sorry). My problem is if I try to start my programm out of a linux console/shell I get a hs_err_log.
# An unexpected error has been detected by Java Runtime Environment:
# SIGSEGV (0xb) at pc=0x062ef37f, pid=6511, tid=3084348304
# Java VM: Java HotSpot(TM) Server VM (1.6.0_03-b05 mixed mode)
# Problematic frame:
# V [libjvm.so+0x2ef37f]
# An error report file with more information is saved as hs_err_pid6511.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
Can someone help me out? Are there some parameters I forgot to set?
thanks

Hi and thanks,
i analyzed the problem a little bit more, I think it is an segmentation fault.
I call function like:
CallLongMethod
FindClass
NewObject
etc.
no error.
But everytime at the some call (env->CallBooleanMethod(m_jobj, method, string, _data);) the programm crashs. I looked at the parameters, all not null. I'm not sure, but is it possible that there is too little memory, if a start the application from a shell?
And how can I do adequate error checking?
Thanks

Similar Messages

  • JNI error

    Hi for everyone...
    I'm having a problem with JNI, I have a C program, and i used Java and JNI to create an interface for it...
    I've done all like the Tutorial, created the shared library, created my interface...
    i've created a little class, just to test my library, and it all worked fine, but when i try to run the library from my interface, i get a strange error:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x4C8B51B2
    Function=principal__Fv+0x12
    it appears a lot of stuff!!
    i'm calling the native method from inside a Button event when i get this error, but when i try to run the native method from the constructor, for example, it all goes fine!!
    Can't i call the method from an event handler??? Is there something i can do to run my app??
    thanks in advance
    R9

    Yeah, i'd already found the error... my native code was using too much memory, with very large vectors... when i made them smaller, it all worked fine...
    thanks anyway for the help...
    R9
    PS.: I am running out of Duke Dollars, is there a way to take some Dollars off this message and back to my acount?? i've already transfered two for you, but i'd like to get the rest back...
    Can't i call the method from an event handler??? Is
    there something i can do to run my app??There are no restrictions as to when you can call
    native methods.
    This VM error means that your native code has accessed
    memory outside its memory space. That is, you have a
    segmentation fault (or in Windows terminology, an
    ACCESS_VIOLATION). In other words your native code
    has some sort of ordinary crashing bug.

  • Remote-Conrol a COM-Application via JNI Error: RPC_E_WRONG_THREAD

    hi,
    we have written a DLL which launches and remotecontrols an application via Microsoft COM. This DLL is called by a Swing-GUI-Application via JNI. It works fine over years. Now we have rewritten our application as an rcp-plugin. The COM-Appplication still launches fine, but when I call a COM-function of the remote-controlled application i get back an error:
    RPC_E_WRONG_THREAD
    ...which means that the wrong threading model is used. Does anyone know about differnt threading models of a swing application and an rcp-plugin?
    thanks for your help
    robert

    Kapila_Shantha wrote:
    But they are saying that they can use and do program using it but they are using RHEL 4 . They are wrong.
    A well done JNI library, regardless of how it is used, should not cause system exceptions.
    That would be true whether you created the library or whether someone else creates it.
    Although if they don't wish to certify it for specific configurations then that could be the cause. If that and only that is the cause then you are out of luck.
    If the real problem is that you are using it incorrectly (which should still not cause that problem) then you need to figure out how to use it correctly.

  • Jni error message interpretation

    Hello all,
    I am using JNI and I am receiving an error here and there.
    I would like to interpret the message that JNI launches when this
    error happens. In particular it would be good to understand this part:
    An unexpected exception has been detected in native code outside the
    VM.
    Unexpected Signal : 11 occurred at PC=0x4D03B46E
    Function=_ZN7MyLibrary5mysock6SelectEiP6fd_setS2_S2_P7timeval+0x278
    1) What is the unexpected signal number 11?
    2) I have understood that the function that crashes is situated in
    MyLibrary, class mysock, function Select and that an object fd_set is
    crashing within the function. But where? and what are all those
    numbers in the function? and what does that timeval mean?
    Thank you for the help.

    1) What is the unexpected signal number 11?Segmentation violation. You tried to access memory outside of the program's address space.
    and what are all those numbers in the function? and
    what does that timeval mean?The error location breaks down to known_function+offset. So, it's saying that the program counter was at an offset of 0x278 bytes from symbol (known location) ZN7MyLibrary5mysock6SelectEiP6fdsetS2_S2_P7timeval. All the numbers are simply a way to differentiate overloaded methods.
    Another poster mentioned using nm(1) to dump out the symbol table, but I'm not convinced that this will get you much, as segmentation violations tend to be separated from the code that actually made the violation happen (ie, you step on memory, run for a while, then try to use that memory).
    I'll assume if you're doing C++ programming that you're familiar with using a regular debugger (such as gdb, the GNU Debugger). If yes, then one good start is to run the JVM in the debugger, look at the stack trace and surrounding code when the SEGV happens, then hopefully discover the piece of memory that's getting stomped on. Build your JNI code with the -g flag turned on.
    If you're running on Sparc/Solaris, and have the Sun development kit, then you've got an even more powerful tool, since the Solaris debugger can do run-time checking of memory references (which often means that you'll see exactly where the memory gets stomped).
    >
    Thank you for the help.

  • JNI errors with C++ ULONG

    I apologize in advance if I am posting this on the wrong forum, I didn't see one for JNI.
    Does anyone know anything about passing a ULONG number from C++ to Java through JNI??
    I am creating a jlong variable:
    jlong tag = (long) e->tag();where e->tag() returns a ulong. We also tried it without the cast to long and got the same results.
    The result is that we are getting the negative equivalent of that ulong. We want all the bits of the number to be the same, and not negative. For instance, if the ulong is 23456789, the number we get back is -23456733, but what I really want is 23456789.
    Any help is appreciated.
    Tonya

    sorry, that output I listed is an example. Some real output is:
    ulong is 2147483656
    value returned to Java code: -2147483640

  • JNI  error in method call

    hello friends,
    I have created WinScheduler.java file in com.csl.client package.. by searching through google i have found its different from creating header file for package than to simple .java file without package.
    So creating header file using package and creating .dll file using same method which is in WinScheduler.h file, I can't call a method in it.
    The error is :
    Exception in thread "main" java.lang.UnsatisfiedLinkError: CreateBatFile
    at com.csl.client.WinScheduler.CreateBatFile(Native Method)
    at com.csl.client.WinScheduler.main(WinScheduler.java:104)
    can u suggest me where to keep the .dll file + .header file, bcoz while running from eclipse the error occurs, I think the method is not found..
    Any suggestions are welcome
    Regards
    Deepak sharma

    can u suggest me where to keep the .dll file + .header fileHeader only impacts compiling the C code.
    The dll must be loaded.
    If you are loading the library then the reason is that the method signatures do not match.
    If you are not loading the library then that of course is the problem.

  • Jni error with jstring

    All i'm trying to do is get a version string from the library. The line of code looks like this:
    return (*env)->NewStringUTF(env,"1.00");
    and i get this error when compiling:
    base operand of '->' has non-pointer type 'JNIEnv_'
    The tutorials show using this line to create jstrings. Am I missing something?

    What is env? What tutorials are these you are talking about?
    (*env)->NewStringUTF(env,"1.00");I don't remember java having the -> or * operations. This looks like C++ to me.

  • Javadoc: error Illegal package name: JNI

    Hi,
    After writting the Java code using native method, Like
    package jni;
    public class jniFile {
    static{
    System.loadLibrary("jniFile");
    public jniFile() {
    System.out.println("Inside constructor ");
    private native void printMessage(String msg);
    public static void main(String[] args) {
    jniFile m= new jniFile();
    m.printMessage("String from java");
    I tried to create the header file using javah -jni jniFile.
    i got "javadoc: error - Illegal package name: "D:\JNI\build\classes\jni" error.
    Can any one help me.
    Thanks in advance.

    The jni package which i used is a user defined one.
    Now i changed it to jniPack.
    Still i cant able to create a header file.
    I am using netbean IDE 5.0.
    I got the following error
    C:\Documents and Settings\GUNR2818>javah -jni D:\JNI\build\classes\jniPack\jniPack
    javadoc: error - Illegal package name: "D:\JNI\build\classes\jniPack\jniPack"
    1 error

  • JVM core dump - JNI code

    I am using JNI in my Java application , 12 hours after running my test case get a JVM crash -
    1) These are the parameters with which i invoke my Java program
    java -d64 -Xcheck:jni -Xmx2560M -Xms2560M -Xss256k RunQueries
    2) The Heap output at the time of the core shows "from space" as 100% used , does this signify anything?
    Heap at VM Abort:
    Heap
    def new generation total 848128K, used 672342K [0xfffffffe93c00000, 0xfffffffec9150000, 0xfffffffec9150000)
    eden space 822464K, 78% used [0xfffffffe93c00000, 0xfffffffebb385b90, 0xfffffffec5f30000)
    from space 25664K, 100% used [0xfffffffec7840000, 0xfffffffec9150000, 0xfffffffec9150000)
    to space 25664K, 0% used [0xfffffffec5f30000, 0xfffffffec5f30000, 0xfffffffec7840000)
    tenured generation total 1747648K, used 1350866K [0xfffffffec9150000, 0xffffffff33c00000, 0xffffffff33c00000)
    the space 1747648K, 77% used [0xfffffffec9150000, 0xffffffff1b884830, 0xffffffff1b884a00, 0xffffffff33c00000)
    compacting perm gen total 16384K, used 13550K [0xffffffff33c00000, 0xffffffff34c00000, 0xffffffff37c00000)
    the space 16384K, 82% used [0xffffffff33c00000, 0xffffffff3493b860, 0xffffffff3493ba00, 0xffffffff34c00000)
    Local Time = Mon Feb 12 21:49:40 2007
    Elapsed Time = 61687
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.4.2_07-b05 mixed mode)
    3) A dbx on the Java core shows the location in the JNI code where the core dump occured.
    dbx `which java` core
    For information about new features see `help changes'
    To remove this message, put `dbxenv suppress_startup_message 7.3' in your .dbxrc
    Reading java
    dbx: internal warning: writable memory segment 0x7cb00000[16384] of size 0 in core
    core file header read successfully
    Reading ld.so.1
    Reading libthread.so.1
    Reading libdl.so.1
    Reading libc.so.1
    Reading libc_psr.so.1
    Reading libjvm.so
    Reading libCrun.so.1
    Reading libsocket.so.1
    Reading libnsl.so.1
    Reading libm.so.1
    WARNING!!
    A loadobject was found with an unexpected checksum value.
    See `help core mismatch' for details, and run `proc -map'
    to see what checksum values were expected and found.
    dbx: warning: Some symbolic information might be incorrect.
    t@1 (l@1) terminated by signal ABRT (Abort)
    0xffffffff7eea822c: lwpkill+0x0008: bcc,a,pt %icc,_lwp_kill+0x18 ! 0xffffffff7eea823c
    Current function is Java_getLoid (optimized)
    7239 e = cod_to_long (*(o_object*) data, &loid_as_long);
    (dbx) where
    current thread: t@1
    [1] lwpkill(0x0, 0x6, 0xffffffffffffffe6, 0x0, 0x0, 0x0), at 0xffffffff7eea822c
    [2] raise(0x6, 0x0, 0xffffffff7fffad30, 0x7fbffeff00003ff6, 0x0, 0x2), at 0xffffffff7ee58a8c
    [3] abort(0x0, 0xffffffff7fffae10, 0x0, 0xfffffffffffffff8, 0x0, 0xffffffff7fffae39), at 0xffffffff7ee3e3b8
    [4] os::abort(0x1, 0xffffffff7e9d295c, 0xffffffff7fffaf10, 0xffffffff7e9d24a9, 0x4b007c, 0xffffffff7eb78878), at 0xffffffff7e90951c
    [5] os::handle_unexpected_exception(0x10011e600, 0xa, 0xfffffffe90345704, 0xffffffff7fffbeb0, 0xffffffff7e69c6f8, 0x0), at 0xffffffff7e907e08
    [6] JVM_handle_solaris_signal(0xffffffff7fffbeb0, 0xffffffff7e9d443e, 0xffffffff7fffbbd0, 0x1, 0x0, 0x1), at 0xffffffff7e69c800
    [7] __sighndlr(0xa, 0xffffffff7fffbeb0, 0xffffffff7fffbbd0, 0xffffffff7e69cb9c, 0x0, 0x0), at 0xffffffff7f2188d8
    ---- called from signal handler with signal 10 (SIGBUS) ------
    =>[8] Java_getLoid(vjEnv = ???, cls = ???, handle = ???, attr = ???) (optimized), at 0xfffffffe90345704 (line ~7239) in "j.c"
    I have added checks for this function call to ensure that no invalid pointer is being sent to it which could cause a segmentation violation.
    Please could someone give me some pointers on how to solve this problem, the error occurs at this point only 12 hours after running the test case..

    First step is to add the option -Xcheck:jni to your java command line. It will flag common JNI errors.
    If that doesn't identify the problem, then compile your jni code with debugging symbols (-g) and add the following option to the java command line when you run your test: -XX:+ShowMessageBoxOnError. When you hit the problem again, the VM will keep the process alive instead of calling abort(). Then you can use dbx to attach to the live process and should be able to get a better idea of what went wrong.

  • Error while running msgshow.java

    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    these errors occur while i run msgshow.java file
    please help me out in this
    thanks

    jackwenttohill wrote:
    MOD:
    Please don't post spam here. I have blocked your messages that contains the link. You are allowed to post a reply with a link to your project if you don't resurrect old threads and if you also explain in the post how it solves the problem. It's not ok to just post a link without any further explanation, and it's not ok to now create a template and post it into all threads that you see.

  • Java 6 upgrade 3 closes windows on XP with no errors-help

    I was running a streamer application on Ameritrade when it asked for a Java upgrade which I did. After that, when I ran the application it would close the Ameritrade window without an error message. I deleted the old environment but that didn't help. I've tried looking for earlier Java programs on thier site but when I go to the free download or try to verify my Java program it closes the window again with no error just like what it did to the Ameritrade streamer application. Help!!

    try enabling verbose output. You can do this from the java control panel. Under the runtime settings add the "-verbose" flag. Next time you start the java plugin you'll see a command prompt start up. Any fatal error might be printed there. You can get a stack dump by hitting the \ + break key in the command prompt window (before the plugin exits). - Sometimes a java program might exit due to a JNI error, If you are using native libraries you could check errors there by adding the "-Xcheck:jni" parameter to the plugin runtime settings.

  • Stack overflow in JNI call

    Hi,
    I am doing a wrapper with JNI for a Windows library of image compression. I have a test program running correctly in C. This program compress data and it can move a lot of memory. If I call this program from a JNI functions I obtain a JNI error:
    An unrecoverable stack overflow has occurred.
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_STACK_OVERFLOW (0xc00000fd) occurred at PC=0x5FF88497
    Function=unpack_data+0x189D7
    Library=C:\WINDOWS\system32\NCSEcw.dll
    This error is produce inside my compression library. I try to adjust the parameters (-Xms -Xmx -Xss) of the JVM but in any case before the process ends it shows this exception. I have done other JNI interfaces and I never found with this problem before. Can anybody help me?
    Thanks in advance.

    I found in this forum a piece of code with a same kind problem but It is simpler than mine. I have proved this program in Windows and it produce the same error. In Linux it runs but if I enlarge the array largebuf it ends with the same error. In Linux I can reserve until 2 MB (in windows +-256K). Is there any way to increase the stack size in a jni call?.
    #include <stdio.h>
    #include <jni.h>
    #include "test.h"
    int myprint2(int a, int b){
         char extrabuf[100];
         printf("got here next\n");
         extrabuf;
         return 0;
    int myprint(int a, int b){
         char largebuf[260000];
         printf("got here\n");
         myprint2(1,1);
         largebuf;
         return 0;
    JNIEXPORT jint JNICALL Java_test_init(JNIEnv *env, jobject obj){
         myprint(1,1);
         return 1;
    test.java
    public class test{
         public native int init();
         public static void main(String []args){
              new test();
         public test(){
              System.loadLibrary("Nat");
              System.out.println(this.init());
    }

  • JVM init error with Illustrator

    Hi,
    always when i try to export the JavaFXInvaders.ai Demo File I get a JVM init Error or my Illustrator crashes. Anyone an idea?
    Greetings Riepi

    here is the end:
    <-WriteTree(0)
    finding Creating jvm
    Jar path: -Djava.class.path=C:\Programme\Adobe\Adobe Illustrator CS3\Zusatzmodule\Illustrator-Formate\AI2JavaFX.jar
    jni: Error occurred during initialization of VM
    jni: Could not reserve enough space for object heapjni:
    Function JNI_CreatedJavaVM failed:
    JVM Init error
    destruction of used names started ...destruction of used names completed.

  • The application runs from netbeans, but not the command-line

    Hi
    I have developed a GUI application using NetBeans. All source code files are compiling without problems and the program runs just fine when i press "run <app name>" in NetBeans. However, when i try to execute the jar file using the command "java -jar <name of jar>", then i get this error message (im standing in the same directory as the jar file which is the dist directory:
    $ java -jar /home/icebyte/NetBeansProjects/TripPlanner/dist/TripPlanner.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: tripplanner/Main
    Caused by: java.lang.ClassNotFoundException: tripplanner.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:221)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    Does someone know why i am getting this error ? I would be nice to find out. I have also tried to go into the src directory of the netbeans project and compile all files there which works fine, but when i try to run the program with "java <file that contains main method>" i get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: MainMenu (wrong name: tripplanner/MainMenu)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:638)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:281)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:216)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    I have JDK and JRE installed on the system (it came with netbeans). I have tried setting the JAVA_HOME variable, but there is no difference. Anyone? Thanks for all help.

    Hmm, i solved the problem now. I looked at this problem yesterday and couldnt find out why i was getting these stack traces, but now i know :)

  • Jint Throw(JNIEnv *env, jthrowable obj) does not trigger Excpetion?

    Greetings.
    I have the following code. When it triggers, the exception does not fire in my java code. Any ideas?
    Thanks,
    Steve
    <===Begin excerpt===>
    /* Displays the last System Error Message in a pop-up, as well as setting an
    * exception to throw.
    * @param env The current environment
    * @param devID The device ID of the Amber card with the error
    * @param msg The Error Message
    * @param error The current error if possible, the name of the Amber call otherwise.
    void doErrorNotification(JNIEnv env, const char portName, char msg, char error){
    displayLastSystemErrorMessage();
    printf("JNI-ERROR: %s\n", msg);
    //Throw SerialException
    jclass controllerException = env->FindClass("com/blueline/serialcomm/SerialException");
    if (controllerException == NULL) {/*Unable to find the Exception class -- give up as we are about to die*/
    printf("FATAL ERROR: Unable to load class: com/blueline/serialcomm/SerialException");
    return;
    //else
    char zbuf[BC_MSGLEN];
    sprintf(zbuf, "%s error: devid %s error %d",
    error, portName, GetLastError());
    if (com_blueline_serialcomm_WindowsComm_DEBUG)
    printf("%s\n", zbuf);
    jmethodID cid = env->GetMethodID(controllerException, "<init>", "([B[B)V");
    if (cid == NULL) {
    printf("Programer Error --> Constructor for SerialException not found.\n");
    jclass loadError = env->FindClass("java/lang/Error");
    if (loadError == NULL) {/*Unable to find the Error class -- give up as we are about to die*/
    printf("FATAL ERROR: Unable to load class: java/lang/Error");
    return;
    //else
    env->ThrowNew(loadError, "Constructor for SerialException not found.");
    return;
    //else
    if (com_blueline_serialcomm_WindowsComm_DEBUG) printf ("JNI-ERROR: Throwing java exception\n");
    jthrowable exception = static_cast<jthrowable>(env->NewObject(controllerException, cid, zbuf, portName));
    if (0 > env->Throw(exception)){
    printf("WindowsComm.ERROR: Unable to throw ErrorException\n");

    jmethodID cid =
    d = env->GetMethodID(controllerException, "<init>",
    "([B[B)V");Here you are calling a ctor that takes two byte arrays
    as parameter.
    There is a constructor that takes two byte arrays as parameters. I wouldn't have to pass it two jbyte array, would I?
    jthrowable exception =
    n =
    static_cast<jthrowable>(env->NewObject(controllerExcept
    on, cid, zbuf, portName));Is this perhaps failing? You are passing in character
    arrays (zbuf, portName) as parameters to a ctor that
    expects byte arrays (see above). Is this a problem?
    You're not checking to see if the NewObject() call is
    failing.How would I check to see if NewObject was failing, by checking to see if exception was NULL?
    >
    if (0 > env->Throw(exception)){
    printf("WindowsComm.ERROR: Unable to throw
    o throw ErrorException\n");I assume that this message is being printed to the
    console ....
    That is correct. At this point, no where else to dump a message {{{:-(
    -Steve

Maybe you are looking for