This content has been marked as final.
Show 1 reply
-
1. Re: Can I access ejb3.0 via corba?
ragavgomatam Jan 6, 2008 10:20 PM (in response to zgmming)I have the snippet attached for accessing ejb via Corba. I had done it with ejb 2.0 in a distributed environment. using the undermentioned snippet For jboss I think you will have to run the "all" configuration that supports iiop. So you might want to start server with run -c all. Also deploy to the "all" configuration & check it out.
import javax.naming.Context; import javax.naming.InitialContext; import org.omg.CORBA.ORB; import org.omg.CosNaming.NamingContextExt; import org.omg.CosNaming.NamingContextExtHelper; ... // Obtaining a reference to the server ORB Context initialContext = new InitialContext(); ORB orb = (ORB) initialContext.lookup("java:comp/ORB"); //Invoking resolve_initial_references // Obtain ORB reference as shown in examples earlier in this section ... org.omg.CORBA.Object obj = orb.resolve_initial_references("NameService"); NamingContextExt initCtx = NamingContextExtHelper.narrow(obj); ... //Steps above illustrate getting Initial Context with CosNaming // Look up the home interface using the name under which the EJB home is //bound (assuming AccountEjb) org.omg.CORBA.Object ejbHome = orb.string_to_object( "corbaname:iiop:myHost:2809/NameServiceServerRoot#mycompany/accounting"); accountHome = (AccountHome)javax.rmi.PortableRemoteObject.narrow(ejbHome, AccountHome.class);