JNI Problem - JAVA invoke C++ and the way back from C++ to JAVA

Hi @ all!
I am a computer science student and I have a problem with the JNI Interface.
First the program structure:
We have a Java GUI a wrapper and a C++ protocol. That is the general communication way:
left side:
JAVA GUI
|
Wrapper (JAVA)
|
C++ protocol
|
|
Network transfer
|
|
C++ protocol
|
Wrapper (JAVA)
|
JAVA Gui
The program sequence is following:
- The GUI will be started and call a protocol init method in the native code. The JAVA and C++ instance are already running!!
- The protocol handles some information.
- Then the left side e.g. invoke a method. The protocol transmits the packet to the other side. But HERE is the problem. On the other side the protocol must call a static JAVA Method from the running JAVA instance.
I have no idea how I can handle this problem. I tried to save the env pointer und the jobject at the first invocation from Java to C++. With this elements I tried to getObjectClass(saved jobject) and tried to invoke the static JAVA method but I got a SIGSEGV from the JVM.
How can I solve this problem??
By the way, I generate through the java wrapper my C++ header and the the Java wrapper load a shared object!
I work with a Gentoo System and with Java 1.5.
I hope anybody can help me!
Cheers,
Edited by: polo6n2 on Jul 3, 2008 1:04 AM

You mean the communication is aschronous?
Then the C++ side will have a C++ thread. That thread calls a method. That method FIRST uses the JNI method to attache the thread.
Then you look up whatever you need in java, maybe a class and you call JNI methods to interact with it.
If you don't attach the thread it will not work.
JAVA method but I got a SIGSEGVThen you did something wrong in your C++ code.

Similar Messages

Maybe you are looking for

  • Missing calls--pho​ne not ringing

    Sometimes my phone acts like it's on silent mode: a call comes in and I can see it on the screen, but it's not making any ringing sound. The very next call rings just fine, even if it's the same person who just called when the phone was silent. Sound

  • HT2534 but i didn't find the NONE option on the under the card name

    but i didn't find the NONE option on the under the card name

  • Java -version error

    Hello, I am installing 11.1.1.7  Soa Suite etc, and given all the talk about Jrocket, decided to give that a spin.  I am on Windows 7 when I do a simple java -version I get the following: [WARN ][osal   ] Could not enumerate processes (1) error=-1073

  • Strange package problem

    The code is like this: package fjava.edu; import java.io.*; public class Point implements Serializable { // Methods... }Now, when i try to import "Point" I get problem. the importing class looks like this: import java.io.*; import javar.util.*; impor

  • RMAN database  continuously restarting by its own

    Hi Team, we have a database named RMAN version 10.2.0.3, which is continuously restarting for every 3 hours, I dont see any issue in alert log. This is a rman catalog database. Is this normal or is there a specific reason for this. Thanks and Regards