EJB and JNI

I have a product write by JNI to call some java object on server side. Like

VB -> JNI bridge -> client jar -> (RMI) -> server.

Now the server was changed to J2EE & EJB2.1. The procedure become

VB -> JNI bridge -> client jar -> (EJB) Server

I tried to call the EJB from VB thought JNI, the bridge was crash when JNI try to create object that define in java (in Client jar).

My question is 揇oes JNI can work with EJB? Where I can find example of how to compile or any related information?

Thanks!

[568 byte] By [GeoZHa] at [2007-11-26 13:43:02]
# 1
JNI works with java. EJBs exist only in java. So yes JNI works with EJB.If the result was a "crash" the most likely reason one of the following.1. You are not doing complete error checking on JNI api calls2. There is a bug in the C/C++ code (or third party library.)
jschella at 2007-7-8 1:16:17 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

Thank you so much!

My JNI like next, error is happen on NewObject

Jc= WJC::getClass("/MyJar/myClass");

if(Jc==0){ error=WJC::getError(); return; }

jmethodID constructor= WJC::getMethodID(Jc,"<init>","()V");

if(constructor==0){error="Impossible to find 'myClass' constructor method ID";return;

}

Jthis= WJC::getEnv()->NewObject(Jc, constructor);

In RMI version,this program works well. In EJB version, "myClass" have no change at all. Only different is "myjar" modified for access EJB.

Do I need change somthing in my Jar?

GeoZHa at 2007-7-8 1:16:17 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
>Do I need change somthing in my Jar?I told you the most common sources of errors in my previous reply.Your code demonstrates that it has no error checking at all. It has nothing to do with java code.
jschella at 2007-7-8 1:16:17 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
I found the reason why my program crash. I need input all of java package into my jar. Include j2ee and server runtime. Now it working.Anyway thank you for answering.
GeoZHa at 2007-7-8 1:16:17 > top of Java-index,Java HotSpot Virtual Machine,Specifications...