src/main/java/org/jboss/util/naming/Util.java
public static Object lookup(String name, Class<?> clazz) throws Exception
   {
      InitialContext ctx = new InitialContext();
      try
      {
         return lookup(ctx, name, clazz);
      }
      finally
      {
         ctx.close();
      }
   }
public static Object lookup(String name, Class<?> clazz) throws Exception
   {
      InitialContext ctx = new InitialContext();
      try
      {
         return lookup(ctx, name, clazz);
      }
      finally
      {
         ctx.close();
      }
   }
public static Object lookup ( String name , Class < ? > clazz ) throws Exception { InitialContext ctx = new InitialContext ( ) ; try { return lookup ( ctx , name , clazz ) ; } finally { ctx . close ( ) ; } }
Lookup an object in the default initial context

@param name the name to lookup
@param clazz the expected type
@return the object
@throws Exception for any error
Lookup an object in the default initial context