Problem:
- Product Name: Borland Enterprise Server (AppServer)
- Product Version: All
- Product Component: EJB
- Platform/OS Version: All
How to access ORB within an ejb bean in a portable manner?
Resolution:
Code snippet as follows:
:
javax.naming.InitalContext ctx;
org.omg.CORBA.ORB orb;
ctx = new javax.naming.InitialContext();
orb = ctx.lookup("java:comp/ORB");
:
DISCUSSION:
When writing a ejb bean it is not uncommon to access a external CORBA resource. To do so an ORB needs to be available. This may be done by creating a new ORB via org.omg.CORBA.ORB.init() but it might be more economical to use the underlying ORB of the ejb container.
Note, however, that by doing so you get a fully configured ORB where you cannot change properties, for example, there is no way to change the port that the osagent is using. The configured ORB is fully set up during the AppServer process startup.
REFERENCES:
Enterprise JavaBeansTM Specification, Version 2.1, 20.2 "Enterprise Beans Environment as a JNDI Naming Context"
#Security
#VisiBroker




