uCosminexus Application Server, Web Container Functionality Guide
Invocation methods for Enterprise Beans include invocation by using Lookup and invocation by using DI. When you use the Lookup, the invocation method depends upon whether you use the functionality for switching the CORBA Naming Service.
- When you use the functionality for switching the CORBA Naming Service, or when invoking the Enterprise Beans contained in the same EAR
- When the Enterprise Beans to be invoked are contained in the same EAR, invoke the Enterprise Beans as shown in the following example:
- Even if the Enterprise Beans to be invoked are not present in the same EAR, you can use the functionality for switching the CORBA Naming Service and invoke the Enterprise Beans as shown below. For the functionality used for switching the CORBA Naming Service, see 2.10 Switching the CORBA Naming Service in the uCosminexus Application Server Common Container Functionality Guide.
- Example:
Context ctx = new InitialContext() ;
Object o = ctx.lookup("java: comp/env/ejb/cart") ;
CartHome h = (CartHome) PortableRemoteObject.narrow(o, CartHome.class) ;
Cart c = h.create() ;
c.call() ;
- When invoking the Enterprise Beans contained in different EAR without using the functionality for switching the CORBA Naming Service
- When you do not use the functionality for switching the CORBA Naming Service, and if the Enterprise Beans to be invoked are contained in different EAR, invoke Enterprise Beans An example is shown below.
- Example:
Context ctx = new InitialContext() ;
Object o =
ctx.lookup("HITACHI_EJB/SERVERS/MyServer/EJB/APName/Cart") ;
CartHome h = (CartHome) PortableRemoteObject.narrow(o, CartHome.class) ;
Cart c = h.create() ;
c.call() ;
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.