This content has been marked as final.
Show 5 replies
-
1. Re: CORBA Call back Client and Session beans
adrian.brock May 29, 2004 7:50 AM (in response to ghoyle)There are examples in the testsuite, e.g. the ubiquotous HelloWorld
-
2. Re: CORBA Call back Client and Session beans
vashistvishal May 31, 2004 10:05 PM (in response to ghoyle)Just a suggestion on yr scenario, if you dont want to use CORBA to talk to bean then use GSOAP for C/C++ cleint to talk to Stateless Session Bean.
Vishal -
3. Re: CORBA Call back Client and Session beans
ghoyle Jun 1, 2004 5:12 AM (in response to ghoyle)I can not seem to find the test suite, can you tell me where it is please.
Thanks
Geoff -
4. Re: CORBA Call back Client and Session beans
ghoyle Jun 1, 2004 7:13 AM (in response to ghoyle)I have simplified my CORBA client and session bean, so that it should just return a String, no callback, so that I can test a very simple case.
The error i get in my client when i run it is:[jacorb.giop] INFO : ClientConnectionManager: created new conn to target 192.168.0.64:3528 [jacorb.iiop.conn] INFO : Connected to 192.168.0.64:3528 from local port 33511 org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(Unknown Source) at org.omg.CosNaming._NamingContextStub.resolve(Unknown Source) at callbackClient.main(callbackClient.java:59)
I have copied my code below. Can you see where I am going wrong? Do I need to do something else with JBOSS to get it to accept CORBA connections?
Also does JBOSS just output the IOR for the naming service to the terminal when it starts up, or can you get it to put it elsewhere.
Lots of questions I know, sorry.
The Client code is the followingimport org.omg.CORBA.ORB; import java.util.Properties; import org.omg.CosNaming.NamingContext; import org.omg.CosNaming.NamingContextHelper; import org.omg.CosNaming.NameComponent; import com.ssl.simple.*; /** * * @author geoff * @version */ public class callbackClient { /** Creates new callbackClient */ public callbackClient() { } /** * @param args the command line arguments */ public static void main(String args[]) { try { // setting system properties is necessary in order to use this ORB in JDK Properties props = System.getProperties(); props.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB"); props.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORB"); System.setProperties(props); ORB orb = ORB.init(args, props); // the client will use Naming Service org.omg.CORBA.Object ns = orb.resolve_initial_references("NameService"); //org.omg.CORBA.Object ns = orb.resolve_initial_references("CorbaNaming"); if (ns == null) throw new RuntimeException(); NamingContext nc = NamingContextHelper.narrow(ns); if (nc == null) throw new RuntimeException(); // resolve names with the Naming Service String[] client_name_hierarchy = new String [] {"CorbaNaming", "JBoss"}; NameComponent[] aName = new NameComponent[client_name_hierarchy.length / 2]; for (int i=0; i<(client_name_hierarchy.length / 2); i++) { aName = new NameComponent(); aName.id = client_name_hierarchy[i*2]; aName.kind = client_name_hierarchy[i*2+1]; } org.omg.CORBA.Object obj = nc.resolve(aName); com.ssl.simple.GoodDay srv = com.ssl.simple.GoodDayHelper.narrow(obj); if (srv == null) throw new RuntimeException(); System.out.println(srv.requestHello()); // add your client code here } catch (Exception ex) { ex.printStackTrace(); } } }
the Goodday bean classpackage com.ssl.simple; import javax.ejb.CreateException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; /** *Created May 28 Fri, 2004 3:28:29 PM *@Author geoff */ public class GoodDayBean implements SessionBean { private SessionContext sessionContext = null; public void ejbCreate() throws CreateException { } public String requestHello() { return "hello I WONDER IF THIS WILL WORK"; } public void ejbActivate() { } public void ejbPassivate() { } public void ejbRemove() { } public void setSessionContext(SessionContext sessionCtx){ this.sessionContext = sessionCtx; } }
The Goodday interfacepackage com.ssl.simple; import java.rmi.RemoteException; import javax.ejb.EJBObject; /** *Created May 28 Fri, 2004 3:28:29 PM *@Author geoff */ public interface GoodDay extends EJBObject { public String requestHello() throws RemoteException ; }
and the goodday homepackage com.ssl.simple; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; /** *Created May 28 Fri, 2004 3:28:29 PM *Code generated by the NetBeans for java EJB Module *@Author geoff */ public interface GoodDayHome extends EJBHome { public GoodDay create() throws CreateException,RemoteException; }
And finally the deployent descriptor for this.
ejb-jar.xml<?xml version="1.0"?> <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://alpha-am02-mx01/dtd/ejb-jar_1_1.dtd'> <ejb-jar> <enterprise-beans> <session> <ejb-name>GoodDay</ejb-name> <home>com.ssl.simple.GoodDayHome</home> <remote>com.ssl.simple.GoodDay</remote> <ejb-class>com.ssl.simple.GoodDayBean</ejb-class> <session-type>Stateful</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>GoodDay</ejb-name> <method-intf>Remote</method-intf> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar>
-
5. Re: CORBA Call back Client and Session beans
ghoyle Jun 2, 2004 4:56 AM (in response to ghoyle)I have got a copy of the test suite now.
ALthough I can not find the CORBA Client to session bean example
There are examples in the testsuite, e.g. the ubiquotous HelloWorld
Can you pint me in the right direction please.