I'm looking for a tutorial or any additional information on how to make an EJB (or underlying MBean) accessible via CORBA.
This is all I've found: http://www.jboss.org/jbossiiop
I have an existing CORBA server (java-based, but non-standard) and I want to allow it to call into my JBoss MBean. This MBean is already exposed via RMI using an EJB (v2.1).
The current AppServer target version is jboss-eap-4.3.
Edit: I'm hoping my question is just too vague to get answered so here's an update:
I want my EJB running in JBoss to register with the Corba ORB running on a remote separate server. At least I think I do. The existing CORBA client connects to services via a defined IDL/interface that I'm trying to implement via a JBoss EJB. At this point, said client connects to several instances of the same interface to pull information and manage local (same process) services via this interface. I want the JBoss EJB to be dropped in as just another implementation of this CORBA IDL.
My understanding of CORBA is rusty and weak to begin with so I'm not getting very far. I can run an ORB in JBoss easily enough, but it's not clear to me how to set up the binding so the "legacy" CORBA ORB can find it. I can change any part of the JBoss implementation to make this work, but changing the other server is difficult.
Is there a way for the EJB to register itself with a remote server (ala jndi)? Will the existing client be able to connect to Jacorb without a开发者_如何转开发dding jboss specific classes?
In short you have to implement an adapter, deploy it in Jboss, register it with the remote NamingService. In your adapter implementation you call your MBeans.
Now more in details You have a CORBA idl, you generate stubs and skeletons.
interface Stock {
int getQuote( in string company);
};
You provide necessary implementation
public class StockImpl extends StockPOA {
public int getQuote(String company) {
//forward a call to MBean here
}
}
You do the usual CORBA registration stuff. something like:
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(...);
org.omg.PortableServer.POA poa = org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
poa.the_POAManager().activate();
NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
NameComponent [] name = new NameComponent[1];
org.omg.CORBA.Object o = poa.servant_to_reference( new StockImpl(orb,poa));
name[0] = new NameComponent( "Stock", "server");
nc.bind(name, o);
orb.run();
Now your object is registered in the remote NamingService and is accessible via CORBA.
You have to include CORBA jars in the JBOSS classpath.
A Corba orb is a socket listener, so best to use the one under JBoss's control, i.e. the standard orb:
ObjectName ORB_NAME = ObjectNameFactory.create("jboss:service=CorbaORB"); ORB orb = (ORB)server.getAttribute(ORB_NAME, "ORB");
to automatically start your Corba service do it in a JBoss Service mbean: http://community.jboss.org/wiki/examplehelloworldservice
To avoid having to compile IDL you could use the Dynamic Invocation Interface. Have a look at how Axis2 CORBA Module does it: http://wso2.org/library/2807
You do not need an Orb on the classpath if you use the JBoss "all" configuration, this includes Corba.
精彩评论