users@glassfish.java.net

Re: EJB 3 Interoperability issue - need help

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 Dec 2007 12:47:10 PST

Hi Frank,

See attached example of C++ Corba client that connects to EJB3 Stateless session bean (deployed in GlassFish v2-b58g-fcs).

The EJB3 session bean is configured with a Home interface (for EJB 2.x client view) and a concrete "mappedName" (jndiName = "ejb/HelloSessionHome") .

After compiling&deploying the classes, you can generate the IDL files for the home/remote interfaces with the command:

$JAVA_HOME/bin/rmic -idl -d idl -classpath $SAMPLE_PATH/HelloSessionEJB/build/jar:$GLASSFISH_HOME/lib/javaee.jar hello.server.HelloSessionHome hello.server.HelloSessionRemote

Note: I have edited the IDL files to change paths and remove exceptions for simplicity of client code.


The client code uses CosNaming to locate the "ejb/HelloSessionHome" service.

To compile the client code, I used the "mico 2.3.12" library.
The c++ stubs were generated with the commands:
$MICO_HOME/bin/idl HelloSessionHome.idl
$MICO_HOME/bin/idl HelloSessionRemote.idl

Then I compiled the code with the command:
c++ -I. -I$MICO_HOME/include -O2 -Wall -D_REENTRANT -D_GNU_SOURCE -o client *
.cc -rdynamic -L$MICO_HOME/lib -lmico2.3.12 -lmicocoss2.3.12 -ldl -lm -lpthread

And finally, the client can be executed with the command:
./client -ORBNoCodesets -ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBInitRef NameService=corbaloc:iiop:MyServerIP:3700/NameService


I hope this sample can help you.


Note: in the "mico-2.3.12" source distribution, there are better client samples with exception handling for interoperability with EJB (see in "mico/demo/interop/jb..." folder).
[Message sent by forum member 'jmarine' (jmarine)]

http://forums.java.net/jive/thread.jspa?messageID=250633