How can I run a CORBA server inside of VAJ with the IBM ORB (in the WebSphere Test Environment) using classes generated by Inprise Visibroker's idl2java compiler?
This trick only works with Inprise Visibroker generated classes and works by exporting your CORBA server object as an RMI server object. Since IBM has the RMI over IIOP thing going, voila! - you have a CORBA server. Your mileage with other ORBs will vary.
*** This code requires one, albeit simple, modification to generated code (ugh!) but it works.
- Generate your Java classes using the idl2java compiler provided by Inprise and using the "-strict -no_bind -no_examples" options.
- Modify your generated TIE class (named _tie_xxxxxxx), adding "implements java.rmi.Remote"
- Right-click on your TIE class, select Tools => Generate RMI => RMI Stub and Skeleton.
- Use the following code snippet to start a CORBA server:
// Initialize the ORB ORB orb = ORB.init(new String, null); // Create a server instance and a TIE instance MyImpl myImpl = new MyImpl(); _tie_MyInterface myPseudoImpl = new _tie_MyInterface(myImpl); // Register the TIE object in a naming service or put out as an IOR ...code deleted... // Export my server object as an RMI object PortableRemoteObject.exportObject((java.rmi.Remote) myPseudoImpl);