public static ServiceConfiguration findService(final String name) {
    checkParam(name, notNullValue());
    Predicate<ServiceConfiguration> nameOrFullName =
        new Predicate<ServiceConfiguration>() {

          @Override
          public boolean apply(ServiceConfiguration input) {
            return name.equals(input.getName()) || name.equals(input.getFullName().toString());
          }
        };
    for (final ComponentId compId : ComponentIds.list()) {
      ServiceConfiguration a;
      try {
        return Iterables.find(Components.lookup(compId).services(), nameOrFullName);
      } catch (NoSuchElementException ex) {
        if (compId.isRegisterable()) {
          try {
            return ServiceConfigurations.lookupByName(compId.getClass(), name);
          } catch (Exception ex1) {
          }
        }
      }
    }
    throw new NoSuchElementException("Failed to lookup service named: " + name);
  }