View RSS Feed

My Java Tips

JNDI - Fixed qualified names

Rate this Entry
by , 11-01-2011 at 06:07 PM (537 Views)
If the target object has a cell-scoped fixed name defined for it, you can use its qualified form instead of the topology-based qualified name. Even though the topology-based name works, the fixed name does not change with the specific cell topology or with the movement of the target object to a different server.




An example lookup with a qualified fixed name follows.


Java Code:
// Get the initial context as shown in a previous example.
// Using the form of lookup name below, it does not matter which
// server in the cell is used to obtain the initial context.
...
// Look up the home interface using the JNDI name
try {
   java.lang.Object ejbHome = initialContext.lookup(
     "cell/persistent/com/mycompany/accounting/AccountEJB");
   accountHome =
     (AccountHome)javax.rmi.PortableRemoteObject.narrow(ejbHome, AccountHome.class);
   }
catch (NamingException e) { // Error getting the home interface
...
}

Submit "JNDI - Fixed qualified names" to Facebook Submit "JNDI - Fixed qualified names" to Digg Submit "JNDI - Fixed qualified names" to del.icio.us Submit "JNDI - Fixed qualified names" to StumbleUpon Submit "JNDI - Fixed qualified names" to Google

Tags: None Add / Edit Tags
Categories
JBoss

Comments