|
|
|
|||||
|
Hi,
I am trying to write a JNI wrapper for a library that uses ICE. It did not work and after some debugging I found out that it seems to be ICE, to be specific Ice::initialize(). The Java VM crashes with a simple "unexpected exception" out of my control. I thought about threads in general, but a simple pthreads example caused no problems. I tried catching exceptions from Ice::initialize(), but none came. Some other ICE routines caused no problems, either. Did anyone have a similar problem with JNI and ICE? Is there anybody else who tried something linke that? Maybe it's just my machine or I missed something very, very important ... I wrote some code which crashes for me. Thanks in advance for any help, Christoph File Demo.java Code:
public class Demo {
public static void main ( String[] _ ) {
System.loadLibrary( "Demo" );
jniDemo();
}
private static native void jniDemo ();
}
Code:
#include <Ice/Ice.h>
#include "Demo.h"
JNIEXPORT void JNICALL Java_Demo_jniDemo ( JNIEnv *, jclass ) {
int a;
Ice::initialize( a, 0 );
}
Code:
An unexpected exception has been detected in native code outside the VM. Unexpected Signal : 11 occurred at PC=0x810DFE7 Function=[Unknown.] Library=(N/A) libDemo.so was build by g++ -shared -o libDemo.so -lIce I am using Suse Linux, Kernel 2.4.20, GCC 3.2.3, Ice 1.3, Java 1.4.0 Last edited by chappich : 04-27-2004 at 01:12 PM. |
|
|||||
|
Hi,
the code I posted was the shortest to reproduce my error. I tried that already, but after I altered the code again -- you never know -- I still had the same problem. I asume it's something wrong with my machine, gcc or whatever.Just for the sake of completeness: Did you test the unpatched code? What was your testing environment? Thanks, Christoph |
|
||||||
|
Hi Christoph,
Yes, I tried the unpatched code as well. It also worked, but after adding a line to print the value of a, I learned that it was being initialized to a negative value, therefore it wasn't triggering the error condition. Changing the code to initialize it to a positive value caused the same error message you received (signal 11, i.e., segfault). - Mark |
|
|||||
|
Hi Mark,
interesting. I now tried all three versions: If I initialize a as positive value, I get a simple "Aborted" from the VM, which makes sense as Ice::initialize() will try to read argv. Anyhow I get the very bad and ugly "unexpected exception" on a zero and negative values for a. Best regards, Christoph |
|
|||||
|
Actually it's the one you posted in your first reply.
I tried it with argc as 1, -1 and 0. It get the error message I posted in extracts in my initial posting on -1 and 0. An 1 is replied by "Aborted" -- nothing else. If I fill argv with a value to match argc, I again get the 'big' message. Code:
JNIEXPORT void JNICALL Java_Demo_jniDemo ( JNIEnv *, jclass ) {
int argc = 1;
char* argv[] = { "a" };
Ice::initialize( argc, argv );
}
|
|
||||||
|
Christoph,
Are any core files created? If so, do the stack traces provide any helpful information? I've tried to reproduce the crash you describe, but so far I haven't been able to. - Mark |
|
|||||
|
Hi,
unfortunately there is no stack trace. The error message I posted in my initial posting is followed by a library listing, nothing else. As I mentioned before I am using a library which uses Ice itself. I am sure, Ice::initalize() is used correctly in there. Anyway (I think) I found the solution for my problem. I updated to Java 1.4.2_04 as this was a significant difference between your and my environment. It works now, I am able to call remote functions through Ice! If you want to, you should be able to reproduce the crash with Java 1.4.0. Thanks again for your help, Christoph |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bug during Ice::initialize (argc, argv) | wvalcke | Bug Reports | 8 | 08-31-2005 06:08 AM |
| Ice::initialize | panic | Comments | 1 | 10-14-2004 05:01 PM |
| Initialize the communicator? | lisiliao | Help Center | 1 | 04-19-2004 11:42 AM |
| Ice::initialize hangs on Panther | taweili | Help Center | 0 | 11-02-2003 07:28 AM |
| Alternative Ice::initialize in Client | amrufon | Help Center | 2 | 08-08-2003 12:29 AM |